Cleaning Text Copied from PDF: A 12-Sample Paste Artifact Test
Reproducible fixtures for PDF copy/paste artifacts—hard wraps, soft hyphens, headers, spacing—tested with local transforms. This site does not parse PDF files.
- Question
- After copying text out of a PDF, which cleanup steps are safe to automate, and which still need a human?
- Samples
- 12 fixtures
- Generated via core
- 8
- Manual / limits
- 4
- Published
- Modified
- Author
- Dionis Ceban
- Method
- Twelve synthetic paste samples (not PDF bytes) were run through the shared JavaScript core used by Trim Text, Remove Extra Spaces, Remove Empty Lines, Remove Duplicate Lines, and Text Cleanup Studio. Observation-only fixtures record limitations without inventing a repair.
Why this test matters
PDF extractors and viewer copy often inject wraps, soft hyphens, running headers, and spacing noise. Cleaning too aggressively can merge real hyphenated words or delete meaningful numbers.
Tools under test
What automation can and cannot do
Safe to automate (in this corpus)
- Trim line edges
- Collapse runs of horizontal spaces/tabs/nbsp
- Collapse excessive blank lines
- Deduplicate exact repeated header lines after trim
Needs manual review
- Soft-hyphen (U+00AD) removal vs real hyphenated compounds
- Deleting digit-only lines that might be page numbers or data
- Re-flowing hard-wrapped sentences into paragraphs
Not repaired by these tools
- Multi-column reading order
- Missing spaces that glued words together
- Recovering layout, fonts, or tables from the original PDF
Result summary
8 of 12 fixtures were executed through assets/js/tools-src/core.js. 4 entries are labeled manual review or limitation without inventing a transform result.
Full test matrix (12 samples)
| ID | Case | Input | Operation | Observed | Status |
|---|---|---|---|---|---|
| pdf-hard-wrap-01 | Hard line wrapping mid-sentence | This paragraph was wrapped
at arbitrary column widths so
copied text breaks mid sentence. |
identity | This paragraph was wrapped
at arbitrary column widths so
copied text breaks mid sentence. |
Pass |
| pdf-soft-hyphen-02 | Soft hyphen at line break | This is an example of a softhyphen artifact. |
Observation (no auto transform) | Input contains U+00AD soft hyphens between “exam” and “ple”. Automatic de-hyphenation can destroy real compounds. | Manual review |
| pdf-header-repeat-03 | Repeated running header | Quarterly Report
Body line one.
Quarterly Report
Body line two. |
trimText → removeDuplicateLines | Quarterly Report
Body line one.
Body line two. |
Pass |
| pdf-page-numbers-04 | Standalone page numbers | Introduction
12
Next section
13 |
Observation (no auto transform) | Lines that are only digits (12, 13) look like page numbers but could be data. No safe auto-delete without context. | Manual review |
| pdf-excess-spaces-05 | Excess horizontal spaces and tabs | Word1 Word2 Word3 Word4 |
removeExtraSpaces | Word1 Word2 Word3 Word4 |
Pass |
| pdf-blank-lines-06 | Excessive blank lines | Paragraph A.
Paragraph B. |
removeEmptyLines | Paragraph A.
Paragraph B. |
Pass |
| pdf-real-hyphen-07 | Legitimate hyphenated word | well-known example
state-of-the-art model |
trimText → removeExtraSpaces | well-known example
state-of-the-art model |
Pass |
| pdf-multicolumn-08 | Multi-column copy order | Alpha col Beta col
A1 B1
A2 B2 |
Observation (no auto transform) | Copied reading order interleaves columns (Left1 Right1 Left2 Right2). No transform on this site can recover layout intent. | Limitation |
| pdf-bullets-09 | Bullet characters | • First item
• Second item
· Third item |
trimText | • First item
• Second item
· Third item |
Pass |
| pdf-unicode-punct-10 | Unicode punctuation | “Smart quotes” and an em—dash with … ellipsis. |
identity | “Smart quotes” and an em—dash with … ellipsis. |
Pass |
| pdf-joined-words-11 | Words joined incorrectly | thequick brownfox jumps |
Observation (no auto transform) | Missing spaces (thequick brown) cannot be repaired reliably without a dictionary and language model. | Limitation |
| pdf-paragraph-bounds-12 | Paragraph boundaries after wrap cleanup | First paragraph line.
Second paragraph line. |
trimText → removeExtraSpaces → removeEmptyLines | First paragraph line.
Second paragraph line. |
Pass |
Edge cases and failures
Soft hyphens, digit-only lines, and multi-column interleaving are the failure modes that look “almost fixable” but are not safe defaults.
Conclusion
Treat PDF paste as text hygiene: normalize spacing and blanks first, dedupe only exact repeats, and keep hyphen and page-number decisions manual. TextConverterTools never opens or repairs PDF files—only text you paste.
Limitations
- Fixtures are synthetic paste strings, not bytes extracted from real PDF files.
- No OCR, font, or layout recovery is attempted.
- Language-specific hyphenation rules are out of scope.
Reproducibility
Download fixtures.json and expected-results.json from this page. Re-run with npm run guides:evidence against assets/js/tools-src/core.js. Sample count must remain 12.
Downloadable evidence
- Fixture corpus (JSON) (4.5 KB)
- Observed results (JSON) (4.6 KB)
- pdf-paste-corpus.txt (839 B)