Guides
Markdown to PDF & PDF to TXT: Clean Offline Document Workflows
Export Markdown runbooks to A4 or Letter PDFs with CJK font support, and extract clean unwrapped TXT or Markdown from local PDFs via PDF.js.
Quick Answer: Export Markdown drafts to A4 or Letter PDFs locally using pdf-lib with automatic browser Canvas rendering for CJK/Unicode text, and extract plain text or structured Markdown from confidential PDFs via self-hosted PDF.js—rejoining wrapped lines and hyphenated words with zero cloud uploads.
Why confidential specs and PDFs should never touch cloud converters
Architecture runbooks, incident postmortems, and signed PDF contracts routinely pass through free online converters that upload entire documents to remote queues.
TxtTo runs both PDF creation and PDF text extraction completely inside browser memory—no file-size paywalls, no Pandoc or LaTeX setup, and zero outbound bytes.
- Markdown to PDF builds A4 or Letter documents locally with github, clean, or serif theme presets.
- PDF to TXT and PDF to Markdown run on self-hosted PDF.js worker files inside your browser.
- Automatic line-merge heuristics rejoin hard PDF line breaks and hyphenated words.
Exporting Markdown to styled PDF with theme, page size & CJK support
Choose between github, clean, and serif themes, select A4 or Letter paper dimensions, and dial margins anywhere from 8 mm to 40 mm (16 mm by default) while toggling code block styling.
For standard Latin text, pdf-lib embeds crisp vector fonts directly. When your Markdown includes Chinese, Japanese, Korean, or extended Unicode characters, the browser engine automatically renders high-DPI (2x) Canvas pages into the PDF so CJK text never turns into missing-glyph boxes.
Export Markdown to PDF locally
| Setting | Supported Values | Default | Notes |
|---|---|---|---|
| theme | github, clean, serif | github | Controls document typography and styling |
| pageSize | A4, Letter | A4 | Standard ISO 216 or North American layout |
| marginMm | 8 to 40 mm | 16 mm | Adjusts page padding in 2 mm steps |
| syntaxHighlight | true / false | true | Shades fenced code blocks distinctly |
Extracting clean text and page breaks via PDF to TXT
PDF files store visual text coordinates rather than logical paragraphs. When extracting raw lines, PDF to TXT sorts items by page coordinate, detects vertical gaps between paragraphs, rejoins soft line wraps, and repairs hyphenated English words split across lines when mergeBrokenLines is active.
Enable preservePageBreaks whenever you need explicit --- Page Break --- markers between pages for legal review or citation indexing—or switch to PDF to Markdown to reconstruct # headings, bullet lists, and hyperlinks.
PDF to TXT (mergeBrokenLines + preservePageBreaks):
Service Level Addendum
All document parsing executes locally inside client RAM with automatic line-wrap restoration.
--- Page Break ---
Section 2: Retention GuaranteesFixing stubborn column wraps and hyphenation with Remove Line Breaks
When copying excerpts from multi-column academic PDFs or legacy scanned OCR documents, stray line breaks can still remain inside paragraphs.
Paste the extracted draft into Remove Line Breaks with preserveParagraphs and fixHyphenatedWords enabled to collapse single line wraps into smooth paragraphs while keeping blank-line section breaks intact.
References
Frequently asked questions
Does Markdown to PDF support Chinese, Japanese, Korean, and Unicode characters?
Yes. In the browser, any document containing non-WinAnsi characters automatically renders crisp 2x high-DPI Unicode Canvas pages inside the generated PDF.
When should I pick PDF to TXT instead of PDF to Markdown?
Pick PDF to TXT when you want flat plain text or --- Page Break --- markers; pick PDF to Markdown when you want heading detection, header/footer stripping, and preserved links for RAG or notes.
Do PDFs get uploaded to PDF.js servers during extraction?
No. TxtTo bundles self-hosted pdfjs-dist worker assets locally so PDF parsing runs 100% offline in your browser.
Related formats
Related Comparisons
Related Guides
- Preparing PDF, Word & Excel as Clean Markdown for RAG & LLMsTurn confidential PDFs, Word DOCX docs, and Excel sheets into structured Markdown for vector chunking and LLM context—100% locally.
- Stripping AI Markdown Symbols for Word, Email & Clean DocsRemove raw **bold**, ### headings, and code fences from AI responses—or convert Markdown to Rich Text HTML ready for Word, Docs, and Gmail.
- Converting EPUB Ebooks to Markdown for Obsidian & AI StudyUnpack DRM-free EPUB ebooks locally into linked Obsidian Markdown notes or split chapter ZIPs—preserving headings, links, and clean prose.