Install pdf-inspector - Five Ways to Parse PDFs
Pick the integration that fits your toolchain. Every channel below is an official release (crates.io / npm / PyPI) — safe to use.
Prefer not to install? Parse in your browser
No setup needed — drop a PDF in, see its type verdict and Markdown instantly. Everything runs locally.
Install commands per channel
npm install @firecrawl/pdf-inspector
# or
bun add @firecrawl/pdf-inspectorpip install pdf-inspectorcargo add pdf-inspectornpm install @firecrawl/pdf-inspector-wasmOptional: OCR runtime
The default build contains no OCR models, PDFium, or ONNX Runtime. You only need them when you explicitly enable selective OCR and pages actually get routed:
- Set
PDFIUM_LIB_PATHandORT_DYLIB_PATHwhen the shared libraries are not on the platform search path. - The pinned PP-OCRv6 Small model set is downloaded and checksum-verified on the first routed page; offline environments can warm the cache or set
modelDirectorywith offline mode to prohibit network access.
Details in the official OCR runtime setup guide.
Before you install
- Only use official releases (crates.io / npm / PyPI). Avoid unofficial mirrors or third-party downloads.
- On Node.js servers, prefer the async variants (
processPdfAsync, etc.) for heavy calls so the event loop stays free. - The browser WASM build is synchronous — call it from a Web Worker for large documents.
Hit a snag? Check these common questions.
How do I parse my first PDF?
The CLI is the most direct: pdf2md annual-report.pdf prints Markdown, --json returns structured output, --pages 1-3 limits pages, --compact enables token-saving output; use detect-pdf document.pdf --analyze --json to classify only. Full walkthrough in the getting started guide.
How do I use it in Node.js?
import { classifyPdf } from '@firecrawl/pdf-inspector'
const result = classifyPdf(pdfBuffer)
console.log(result.pdfType) // "TextBased" | "Scanned" | "Mixed" | "ImageBased"
console.log(result.pagesNeedingOcr)The complete API is in the API quick reference.
How do I use it in Python?
import pdf_inspector
result = pdf_inspector.process_pdf("document.pdf")
print(result.pdf_type)
print(result.markdown)The complete API is in the API quick reference.
How do I use the WASM build in the browser?
import init, { processPdf } from '@firecrawl/pdf-inspector-wasm'
await init()
const result = processPdf(pdfBytes)
console.log(result.pdfType)
console.log(result.markdown)The demo on this very site is built with this package. See try online.
What about scanned PDFs?
Classify first: classifyPdf tells you the document type and which pages need OCR. The web demo has no OCR; native packages offer selective OCR — only quality-rejected pages go to OCR while the rest stay on the fast local path.
How fast is parsing?
Official opendataloader-bench benchmark: the full 200-PDF corpus completes in 0.470 seconds with an overall score of 0.875 (#1). Text-based PDFs finish end-to-end within 200ms; classification alone takes ~10–50ms. See the benchmark.