← Back to the summary Firecrawl's anydoc: Zero-OCR Rust Library Turns Word, PPT, Excel into Markdown
Zero OCR Dependency! Firecrawl's Rust Library Turns Word / PPT / Excel into Markdown\n\nAuthor: SimonKing\nTags: Backend, Java, Programmer\n\n## 01 Introduction\n\nThose who've built knowledge bases know: the most painful part of converting documents to Markdown is not the format, it's OCR.\n\nTo handle a few scanned pages, you install Tesseract and spend ages configuring Chinese font packs; switch to PaddleOCR and you run out of GPU memory; or you call a cloud OCR API that bills per page, and after a few hundred documents the bill is shocking. Even if the document is plain text, you're still held hostage by the entire OCR dependency chain—installing packages, configuring models, managing keys—none of which you can skip.\n\nSo when I saw Firecrawl's open-source anydoc, the first thing I focused on wasn't "14 formats" or "4.4ms", but the README line: Pure Rust, no ML models, no external services. Translated: zero OCR dependency, works right after installation, no network, no model loading, no money out of pocket.\n\n## 02 Project Overview\n\nanydoc is Firecrawl's open-source pure Rust library that converts 14 formats—Word / PPT / Excel / ODF / RTF / EPUB / CSV / PDF—into GFM Markdown, MIT-licensed, and it's the underlying engine of Firecrawl Parse.\n\nAll formats are first parsed into the same Document intermediate model (blocks / inlines / tables / footnotes / assets), then go through the same GFM serializer—so fixing one table-escaping bug benefits all formats. PDF is a special case, using its own pdf-inspector to output Markdown directly. Format detection relies on byte-content markers rather than file extensions, so even a misnamed extension still converts correctly.\n\nOfficial benchmarks: 100 real documents, 14 formats, median time 4.4ms, quality score 81 (both first). Compared to LibreOffice 1129.5ms, pandoc 102.1ms, markitdown 134.8ms. The data has caveats—self-tested by the project, corpus not public, LLM judge scoring—but the order-of-magnitude difference is credible.\n\nSupported formats:\n\n| Category | Extensions |\n| ------------ | ---------------------------------------------------------- |\n| Word | .doc, .docx, .docm |\n| PowerPoint | .ppt, .pps, .pot, .pptx, .pptm, .ppsx, .ppsm |\n| Excel | .xls, .xlsx, .xlsm, .xlsb |\n| OpenDocument | .odt, .ods, .odp |\n| RTF | .rtf |\n| EPUB | .epub |\n| CSV | .csv |\n| PDF | .pdf |\n\n
\n\nGitHub: https://github.com/firecrawl/anydoc\nOfficial site: https://firecrawl.github.io/anydoc/\n\n## 03 Installation\n\nThe official release offers multiple installation methods.\n\n### 3.1 CLI\n\nNo code needed: directly convert documents to Markdown output to the terminal or a file. The earlier steps involve no OCR at all.\n\nbash\n# Output to stdout\nnpx @firecrawl/anydoc report.docx\n\n# Output to file\nnpx @firecrawl/anydoc slides.pptx -o slides.md\n\n# Read from stdin; formats like CSV without magic numbers must specify the format explicitly\nnpx @firecrawl/anydoc - --format csv < data.csv\n\n# Only when encountering scanned documents, opt-in to hosted OCR\nnpx @firecrawl/anydoc scan.pdf --ocr hosted\n\n\nThe first npx run automatically downloads the platform-specific precompiled binary. For a persistent command, use npm install -g @firecrawl/anydoc, then anydoc --help to see all options. Markdown goes to stdout, errors to stderr—pipeline friendly.\n\n### 3.2 Node.js\n\nPreferred for server-side integration. Converts file paths or byte streams to Markdown, asynchronous and non-blocking for the event loop, with full TypeScript types.\n\nbash\nnpm install @firecrawl/anydoc\n\n\njs\nimport { toDocument, toMarkdown, toMarkdownBytes } from '@firecrawl/anydoc';\n\n// Convert from file path\nconst markdown = await toMarkdown('report.docx');\n\n// Opt-in OCR (official README example is missing a closing brace; corrected below)\nconst markdownWithOcr = await toMarkdown('report.docx', { ocr: 'hosted' });\n\n// Convert from bytes, format auto-detected\nconst fromBytes = await toMarkdownBytes(bytes);\n\n// CSV has no magic number; must specify the format explicitly\nconst fromCsv = await toMarkdownBytes(bytes, 'csv');\n\n// Get the intermediate model (which contains embedded assets)\nconst document = await toDocument(bytes);\n\n\nIt can be called directly via JS, or turned into a web page.\n\n### 3.3 Python\n\nFor conversion inside Python data pipelines; releases the GIL during conversion, so multithreading is unaffected, and ships with type stubs.\n\nbash\npip install firecrawl-anydoc\n\n\npython\nimport anydoc\n\n# Convert from file path\nmarkdown = anydoc.to_markdown("report.docx")\n\n# Opt-in OCR, parse_mode can be auto / fast / ocr\nmarkdown = anydoc.to_markdown("scan.pdf", ocr="hosted", parse_mode="ocr")\n\n# Convert from bytes, auto-sniffs the format\nmarkdown = anydoc.to_markdown_bytes(data)\n\n# CSV needs the format explicitly\nmarkdown = anydoc.to_markdown_bytes(data, "csv")\n\n# Get the intermediate model; embedded assets are inside\ndocument = anydoc.to_document(data)\n\n\n### 3.4 Browser / WASM\n\nPure front-end conversion—no OCR service even exists; the file stays in the browser, suitable for compliance-sensitive scenarios.\n\nbash\nnpm install @firecrawl/anydoc-wasm\n\n\njs\nimport init, { toMarkdownBytes, toDocument } from '@firecrawl/anydoc-wasm';\n\nawait init(); // WASM must be initialized first\n\nconst markdown = toMarkdownBytes(bytes);\nconst fromCsv = toMarkdownBytes(bytes, 'csv');\nconst document = toDocument(bytes);\n\n\nThe WASM version uses a synchronous API (no await for the conversion step)—don't confuse it with the Node version.\n\n### 3.5 Rust\n\nEmbed into a Rust service with zero network calls and maximum performance.\n\nbash\ncargo add anydoc\n\n\nrust\nlet markdown = anydoc::to_markdown("report.docx")?;\nlet markdown = anydoc::to_markdown_bytes(&bytes, None)?;\nlet markdown = anydoc::to_markdown_bytes(&bytes, anydoc::Format::Csv)?;\nlet document = anydoc::to_document(&bytes, None)?;\n\n\nThe Rust crate has no ocr option and will never make network requests. If you really need OCR, you must connect to a service yourself outside Rust—this is a deliberately pure boundary.\n\n### 3.6 Agent Skill\n\nLet AI convert documents on its own. Install a skill for the agent, and it will automatically use the anydoc CLI when encountering office documents.\n\nbash\nnpx skills add firecrawl/anydoc\n\n\nThe skill is defined in skills/convert-documents-to-markdown/SKILL.md, compatible with Claude Code, Codex, Cursor, OpenCode, and other clients following the agentskills.io protocol.\n\n## 04 Practical Tests\n\nThe simplest installation is just handing it to an agent and using it as a skill. For our demo, we can use the official demo page, which is also the official site's homepage: https://firecrawl.github.io/anydoc/\n\n### 4.1 PDF Test\n\nSource file:\n\n
\n\nAfter conversion, the recognized text is displayed directly:\n\n
\n\nConverted result:\n\n
\n\nFormatting issues are unavoidable, but text recognition is essentially correct. This provides a solid foundation for building knowledge bases.\n\n### 4.2 Word Test\n\n
\n\nWord conversion is quite impressive, preserving basic formatting.\n\n### 4.3 PPT Test\n\n
\n\n## 05 Summary\n\nThere are many tools for converting to Markdown, but the zero-OCR dependency is definitely anydoc's most underestimated advantage. For RAG knowledge base ingestion, batch document preprocessing, content migration that needs to preserve heading hierarchy and table structure, and online conversion with low latency or compliance requirements, anydoc is a major asset.