[package] name = "pdf-inspector" version = "1.15.0" edition = "2021" autobins = false authors = ["Firecrawl Team"] description = "Fast PDF inspection, classification, and text extraction with smart scanned vs text-based detection" license = "MIT" repository = "https://github.com/firecrawl/pdf-inspector" readme = "docs/rust-api.md" # Explicit allowlist: crates.io caps uploads at 10 MiB and tests/fixtures # alone exceeds that. external/bcmaps ships in the crate — tounicode.rs # loads it at runtime relative to CARGO_MANIFEST_DIR. include = [ "/src/**", "/external/bcmaps/**", "/docs/rust-api.md", "/LICENSE", # maturin derives the sdist file list from this allowlist; the stub must # ship so wheels built from the sdist keep their type hints. "/pdf_inspector.pyi", ] [lib] name = "pdf_inspector" crate-type = ["lib", "cdylib"] [dependencies] # Python bindings pyo3 = { version = "0.25", features = ["extension-module", "abi3-py38"], optional = true } # Error handling thiserror = "2.0" # Logging log = "0.4" # Text processing regex = "1.10" once_cell = "1.19" unicode-normalization = "0.1" # TrueType font parsing (for Identity-H CID font cmap extraction) ttf-parser = "0.25" # Native builds keep lopdf's parallel parser and CLI logging. Browser WASM is # deliberately single-threaded so it works without cross-origin isolation. [target.'cfg(not(target_arch = "wasm32"))'.dependencies] lopdf = { version = "0.42.0", features = ["rayon"] } rayon = "1.10" env_logger = "0.11" # Optional native page rendering for OCR pipelines. PDFium is loaded at # runtime, so enabling this feature does not link or download a native library. firecrawl-pdfium = { version = "0.1.0", optional = true } # Small support crates used only by the opt-in model cache. Model files remain # external and are never embedded in pdf-inspector artifacts. dirs = { version = "6.0", optional = true } fs2 = { version = "0.4", optional = true } sha2 = { version = "0.11", optional = true } # Optional CPU OCR backend. Models and ONNX Runtime stay external: the latter # is loaded dynamically from ORT_DYLIB_PATH or the platform library search path. image = { version = "0.25.6", default-features = false, optional = true } oar-ocr = { version = "0.9.1", default-features = false, features = ["simd"], optional = true } ort = { version = "=2.0.0-rc.13", default-features = false, features = ["load-dynamic"], optional = true } # HTTPS-only streaming downloader for pinned model artifacts. Kept separate # from model-cache so offline and package-managed deployments avoid HTTP/TLS. ureq = { version = "3.4", default-features = false, features = ["rustls", "platform-verifier"], optional = true } [target.'cfg(all(windows, not(target_arch = "wasm32")))'.dependencies] windows-sys = { version = "0.61", features = ["Win32_Storage_FileSystem"], optional = true } # Browser builds use JavaScript randomness for encrypted PDFs and embed the # bundled CMaps because there is no filesystem at runtime. [target.'cfg(target_arch = "wasm32")'.dependencies] lopdf = { version = "0.42.0", default-features = false, features = ["wasm_js"] } include_dir = "0.7" [dev-dependencies] tempfile = "3.3" [features] default = [] python = ["pyo3", "ocr"] vision = [] model-cache = ["vision", "dep:dirs", "dep:fs2", "dep:sha2", "dep:windows-sys"] model-download = ["model-cache", "dep:ureq"] ocr-oar = ["model-cache", "dep:image", "dep:oar-ocr", "dep:ort"] render-pdfium = ["vision", "dep:firecrawl-pdfium"] # Complete native OCR path. This remains opt-in so default library, # renderer-only, and browser consumers do not inherit inference or HTTP/TLS. ocr = ["render-pdfium", "ocr-oar", "model-download"] [[bin]] name = "pdf2md" path = "src/bin/pdf2md.rs" [[bin]] name = "detect-pdf" path = "src/bin/detect_pdf.rs" [[bin]] name = "dump_ops" path = "src/bin/dump_ops.rs"