Update README.md
Browse files
README.md
CHANGED
|
@@ -11,9 +11,119 @@ pinned: false
|
|
| 11 |
short_description: A simpe app that counts characters including spaces in PDF
|
| 12 |
---
|
| 13 |
|
| 14 |
-
#
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
short_description: A simpe app that counts characters including spaces in PDF
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# PDF Character Counter
|
| 15 |
|
| 16 |
+
A simple and reliable PDF character counting tool that extracts text from PDF documents and counts only the actual content.
|
| 17 |
|
| 18 |
+
Unlike many basic PDF counters, this tool automatically detects and removes:
|
| 19 |
+
|
| 20 |
+
* Page numbers
|
| 21 |
+
* Repeated headers
|
| 22 |
+
* Repeated footers
|
| 23 |
+
* Running chapter headers
|
| 24 |
+
|
| 25 |
+
This makes it useful for academic papers, theses, reports, assignments, and other documents where administrative text should not be included in the final character count.
|
| 26 |
+
|
| 27 |
+
## Features
|
| 28 |
+
|
| 29 |
+
β
Accurate PDF text extraction
|
| 30 |
+
|
| 31 |
+
β
Automatic page number removal
|
| 32 |
+
|
| 33 |
+
β
Automatic header detection
|
| 34 |
+
|
| 35 |
+
β
Automatic footer detection
|
| 36 |
+
|
| 37 |
+
β
Running chapter header detection
|
| 38 |
+
|
| 39 |
+
β
Per-page character statistics
|
| 40 |
+
|
| 41 |
+
β
Optional page exclusion
|
| 42 |
+
|
| 43 |
+
β
Detailed diagnostics showing removed content
|
| 44 |
+
|
| 45 |
+
## How It Works
|
| 46 |
+
|
| 47 |
+
The application processes PDFs in six steps:
|
| 48 |
+
|
| 49 |
+
1. Extract all text blocks from every page.
|
| 50 |
+
2. Detect recurring headers and footers based on position and repetition.
|
| 51 |
+
3. Identify page numbers using pattern matching.
|
| 52 |
+
4. Detect running chapter headers.
|
| 53 |
+
5. Remove non-content elements.
|
| 54 |
+
6. Count characters in the remaining text.
|
| 55 |
+
|
| 56 |
+
Only the cleaned content is included in the final count.
|
| 57 |
+
|
| 58 |
+
## What Gets Removed
|
| 59 |
+
|
| 60 |
+
### Page Numbers
|
| 61 |
+
|
| 62 |
+
Examples:
|
| 63 |
+
|
| 64 |
+
```text
|
| 65 |
+
Page 12
|
| 66 |
+
12
|
| 67 |
+
12 / 120
|
| 68 |
+
12 of 120
|
| 69 |
+
Side 12
|
| 70 |
+
12 af 120
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### Running Headers
|
| 74 |
+
|
| 75 |
+
Examples:
|
| 76 |
+
|
| 77 |
+
```text
|
| 78 |
+
2.1 Methods 12
|
| 79 |
+
4.3 Results iv
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### Repeated Headers and Footers
|
| 83 |
+
|
| 84 |
+
Text that appears on multiple pages in the top or bottom regions of the document is automatically detected and excluded.
|
| 85 |
+
|
| 86 |
+
## Output
|
| 87 |
+
|
| 88 |
+
The tool returns:
|
| 89 |
+
|
| 90 |
+
* Total character count
|
| 91 |
+
* Character count per page
|
| 92 |
+
* Included text
|
| 93 |
+
* Detected headers
|
| 94 |
+
* Detected footers
|
| 95 |
+
* Detected running headers
|
| 96 |
+
* Detected page numbers
|
| 97 |
+
* Log of removed elements
|
| 98 |
+
|
| 99 |
+
## Use Cases
|
| 100 |
+
|
| 101 |
+
* Academic assignments
|
| 102 |
+
* University theses
|
| 103 |
+
* Research papers
|
| 104 |
+
* Government reports
|
| 105 |
+
* Technical documentation
|
| 106 |
+
* Publication word/character limit verification
|
| 107 |
+
|
| 108 |
+
## Technology
|
| 109 |
+
|
| 110 |
+
Built with:
|
| 111 |
+
|
| 112 |
+
* Python
|
| 113 |
+
* PyMuPDF (fitz)
|
| 114 |
+
* Regular Expressions
|
| 115 |
+
* Hugging Face Spaces
|
| 116 |
+
|
| 117 |
+
## Limitations
|
| 118 |
+
|
| 119 |
+
* Scanned PDFs without embedded text require OCR before processing.
|
| 120 |
+
* Very unusual document layouts may affect automatic header/footer detection.
|
| 121 |
+
* Character counts are based on extracted text and may differ slightly from counts generated by word processors.
|
| 122 |
+
|
| 123 |
+
## License
|
| 124 |
+
|
| 125 |
+
MIT License
|
| 126 |
+
|
| 127 |
+
## Author
|
| 128 |
+
|
| 129 |
+
Created by Daniel Hjerresen.
|