Skip to content

Guide · Open source

How to use anydoc: convert Word, PDF and CSV to Markdown

Updated · written with AI from the project's own documentation and checked against our catalogue data

anydoc is an open-source library from Firecrawl that reads office and document files and turns them into clean GitHub-flavored Markdown. It is aimed at developers, data teams and AI agent builders who need document text in a consistent format. After this guide you will know how to install it, convert files from the command line or code, and handle scanned PDFs.

anydocfirecrawl/anydoc · ★ 23.3k · MIT

Quick start

  1. 1Pick your environment. Choose the CLI, Node.js, Python, browser or Rust, depending on where your files are processed.
  2. 2Install the package. Run the matching install command, such as npm install @firecrawl/anydoc or pip install firecrawl-anydoc.
  3. 3Convert a test file. Run npx @firecrawl/anydoc report.docx to print Markdown to the terminal and check the output.
  4. 4Save output to a file. Add -o followed by a filename to write the Markdown to disk instead of stdout.
  5. 5Name the format for CSV bytes. When passing raw bytes without a file name, give the format explicitly, such as 'csv', because CSV has no signature.
  6. 6Enable OCR for scanned PDFs. Add the hosted OCR option only to documents that fail with NeedsOcr, since those pages are sent to Firecrawl Parse.

What formats does anydoc convert?

anydoc reads Word (.doc, .docx, .docm), PowerPoint (.ppt, .pps, .pot, .pptx, .pptm, .ppsx, .ppsm), Excel (.xls, .xlsx, .xlsm, .xlsb), OpenDocument (.odt, .ods, .odp), RTF, EPUB, CSV and PDF files.

The format is detected from the bytes themselves, so a mislabeled file can still convert correctly. CSV has no signature, so when you pass bytes you should name the format yourself.

  • Every format goes through a shared document model and one Markdown serializer, so output looks consistent across inputs.
  • Headings, lists, tables, links, footnotes, speaker notes and equations (as LaTeX) are carried over where the source has them.

Install anydoc on your system

anydoc is installed through a package manager. Which command you need depends on the language you work in. The Node.js package needs Node.js, and the Python package needs Python.

The Rust crate is added to a Cargo project with cargo add.

  • Command line or Node.js: npm install @firecrawl/anydoc
  • Python: pip install firecrawl-anydoc
  • Rust: cargo add anydoc
  • Browser (WebAssembly): npm install @firecrawl/anydoc-wasm
npm install @firecrawl/anydoc

Convert a file with the command line

You can run anydoc without installing it using npx. It prints Markdown to stdout by default, or writes to a file when you pass -o.

npx downloads the prebuilt binary for your platform on first run. For a permanent anydoc command, install it globally. Run anydoc --help to see every option.

  • Send Markdown to the terminal: npx @firecrawl/anydoc report.docx
  • Write to a file: npx @firecrawl/anydoc slides.pptx -o slides.md
  • Read CSV from stdin: npx @firecrawl/anydoc - --format csv < data.csv
npx @firecrawl/anydoc report.docx # Markdown to stdout npx @firecrawl/anydoc slides.pptx -o slides.md # or to a file npx @firecrawl/anydoc - --format csv < data.csv # read stdin

Convert files in Node.js or Python

In Node.js, toMarkdown takes a file path and returns Markdown. toMarkdownBytes takes bytes and detects the format, or accepts a format name for CSV. toDocument returns the document model, which also carries embedded assets.

In Python the functions are named the same way, using to_markdown, to_markdown_bytes and to_document. The Rust crate offers matching functions with an optional format argument.

import { toMarkdown } from '@firecrawl/anydoc'; const markdown = await toMarkdown('report.docx');

Handle scanned PDFs and OCR

anydoc reads text-based PDFs locally but does no OCR itself. A PDF with scanned or image-only pages fails with NeedsOcr. To convert those, opt in to hosted OCR through Firecrawl Parse. The README says no signup is needed, and setting FIRECRAWL_API_KEY gives higher limits.

Only documents that need OCR leave your machine, and the whole document is sent because Parse has no page selection. The Rust crate has no OCR option and makes no network calls.

  • CLI: anydoc scan.pdf --ocr hosted
  • Node.js: toMarkdown('scan.pdf', { ocr: 'hosted' })
  • Python: anydoc.to_markdown('scan.pdf', ocr='hosted')
  • parse-mode options: auto (default) extracts text and falls back to OCR, fast extracts text only, ocr OCRs every page.
npx @firecrawl/anydoc scan.pdf --ocr hosted

Try anydoc in the browser

The project has a demo page that runs the library as WebAssembly. Files are converted locally in your browser and are not uploaded, according to the README.

The WebAssembly package exposes toMarkdownBytes and toDocument after you call init().

Use anydoc as an agent skill

anydoc ships as an Agent Skill, so an AI agent can read office documents it encounters. The skill teaches the agent to convert files with the anydoc CLI. The README lists Claude Code, Codex, Cursor and OpenCode as compatible agents.

npx skills add firecrawl/anydoc

What people use it for

  • Feed Word or PowerPoint content into an LLM pipeline as Markdown.
  • Give an AI agent the ability to read office files through the Agent Skill.
  • Convert a folder of Word or PowerPoint files into one consistent Markdown format.
  • Turn CSV or Excel exports into Markdown for documentation or review.
  • Convert files in the browser without uploading them, using the WebAssembly demo.

Frequently asked questions

Is anydoc free to use?

anydoc is released under the MIT licence, as stated in the README. The README does not list pricing for the hosted Firecrawl Parse OCR service, so check Firecrawl directly for hosted usage terms.

What do I need to install anydoc?

For the command line or Node.js package you need Node.js, which npx uses. For the Python package you need Python and pip. The Rust crate is added to a Cargo project with cargo add anydoc.

Why does my scanned PDF fail with NeedsOcr?

anydoc does no OCR itself, so PDFs with scanned or image-only pages raise NeedsOcr. Opt in with the hosted OCR option, such as --ocr hosted in the CLI, to send those documents to Firecrawl Parse.

Does anydoc keep the exact layout of my documents?

The README does not claim pixel-perfect layout preservation. It describes output as clean, consistent Markdown that keeps structure such as headings, lists and tables.

What are alternatives to anydoc?

The README lists pandoc, markitdown, docling and unstructured as comparable projects. Choose based on your formats, language and whether you need a Rust library or a tool with a different focus.

Is there a desktop app for anydoc?

The README focuses on the command line and code bindings. It does not describe a point-and-click desktop application, so you would use the CLI, a language binding or the browser demo.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

anydoc suits developers, data teams and AI agent builders who need consistent Markdown from many office and PDF files, and who are comfortable with a command line or code. It is a weaker choice if you need exact visual layout, a desktop app, or scanned PDF conversion without sending files to the hosted OCR service.

Install options & downloads