Guides
Preparing PDF, Word & Excel as Clean Markdown for RAG & LLMs
Turn confidential PDFs, Word DOCX docs, and Excel sheets into structured Markdown for vector chunking and LLM context—100% locally.
Quick Answer: LLMs and vector databases chunk semantic Markdown far more reliably than raw `.pdf`, `.docx`, or `.xlsx` binaries because headings, lists, and GFM tables preserve document structure. TxtTo parses PDF.js pages, OOXML styles, and multi-sheet Excel workbooks locally in browser RAM into RAG-ready Markdown.
Why raw PDF/DOCX extraction ruins RAG retrieval accuracy
Vector databases retrieve relevant paragraphs poorly when documents enter as unstructured plain-text blobs full of mid-sentence PDF line wraps, repeating page numbers, and flattened table rows.
Semantic Markdown (`#` headings, `-` lists, `[links](url)`, and `| table |` grids) lets chunkers split cleanly along section boundaries so every embedding retains its section title.
- Font-size heuristics restore `#` and `##` headings from visual PDF text.
- Broken mid-sentence wraps merge back into continuous prose paragraphs.
- Repeating page headers and footers get filtered out automatically.
Extracting PDFs locally with self-hosted PDF.js
Uploading board decks, legal agreements, or internal specs to third-party PDF converters exposes confidential IP. TxtTo runs a self-hosted PDF.js worker directly from your browser origin with zero external CDN requests.
Every PDF extracts right in browser RAM, turning multi-page briefs into structured Markdown ready for embedding or prompt pasting.
Pure-TS Word (.docx) & Excel (.xlsx) extraction
Word `.docx` archives already store explicit `Heading1` styles, hyperlinks, lists, and `<w:tbl>` grids inside `word/document.xml`. Reading OOXML directly preserves structure cleanly while discarding bloated embedded media.
Similarly, Excel workbooks convert cleanly into aligned GFM pipe tables so LLMs read multi-column financial rows without losing column headers.
## Q3 Architecture Metrics
| Region | Latency (ms) | Availability |
| :--- | :--- | :--- |
| US-East | 38.4 | 99.99% |
| EU-West | 42.1 | 99.98% |Budgeting chunk sizes with an offline token counter
Once your documents are clean Markdown, check total token counts against GPT-5, Claude 4, or Gemini 2.5 context windows before chunking or sending prompts.
References
Frequently asked questions
Can OCR-free local extraction read scanned image PDFs?
No. Client-side PDF extraction reads selectable text layers cleanly; image-only scans without embedded text require OCR.
Does Word to Markdown keep hyperlinks and numbered lists?
Yes. Relationships in word/_rels/document.xml.rels resolve clickable Markdown links while numbering definitions reconstruct bullet and ordered lists.
Why use Markdown tables instead of raw CSV inside long RAG docs?
Markdown pipe tables align cleanly inside prose documents without breaking surrounding heading hierarchy during Markdown-aware chunk splitting.
Related formats
Related Comparisons
Related Guides
- Markdown to PDF & PDF to TXT: Clean Offline Document WorkflowsExport Markdown runbooks to A4 or Letter PDFs with CJK font support, and extract clean unwrapped TXT or Markdown from local PDFs via PDF.js.
- 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.
- Building Valid JSONL Fine-Tuning Datasets from CSV & JSONFormat valid OpenAI chat, Alpaca, and Gemini fine-tuning .jsonl files from spreadsheets and JSON arrays locally with per-line validation.