opendataloader-pdf
ライブラリopendataloader-project/opendataloader-pdf
AI データ抽出とアクセシビリティのための PDF パーサー。
概要
オープンソースPDF解析器。構造化データ(Markdown、JSON、HTML)を抽出し、バウンディングボックス、読み取り順序、テーブル対応を含む。未タグ付けPDFを自動的にタグ付きPDFに変換してアクセシビリティを実現、オプションでエンタープライズ級PDF/UAエクスポートに対応。抽出精度ベンチマークで第1位。
README プレビュー
\n\n# OpenDataLoader PDF\n\n**PDF Parser for AI-ready data. Automate PDF accessibility. Open-source.**\n\n[](https://github.com/opendataloader-project/opendataloader-pdf/blob/main/LICENSE)\n[](https://pypi.org/project/opendataloader-pdf/)\n[](https://www.npmjs.com/package/@opendataloader/pdf)\n[](https://search.maven.org/artifact/org.opendataloader/opendataloader-pdf-core)\n[](https://github.com/opendataloader-project/opendataloader-pdf#java)\n\n\n\n🔍 **PDF parser for AI data extraction** — Extract Markdown, JSON (with bounding boxes), and HTML from any PDF. #1 in benchmarks (0.907 overall). Deterministic local mode + AI hybrid mode for complex pages.\n\n- **How accurate is it?** — #1 in benchmarks: 0.907 overall, 0.928 table accuracy across 200 real-world PDFs including multi-column and scientific papers. Deterministic local mode + AI hybrid mode for complex pages ([benchmarks](#extraction-benchmarks))\n- **Scanned PDFs and OCR?** — Yes. Built-in OCR (80+ languages) in hybrid mode. Works with poor-quality scans at 300 DPI+ ([hybrid mode](#hybrid-mode-1-accuracy-for-complex-pdfs))\n- **Tables, formulas, images, charts?** — Yes. Complex/borderless tables, LaTeX formulas, and AI-generated picture/chart descriptions all via hybrid mode ([hybrid mode](#hybrid-mode-1-accuracy-for-complex-pdfs))\n- **How do I use this for RAG?** — `pip install opendataloader-pdf`, convert in 3 lines. Outputs structured Markdown for chunking, JSON with bounding boxes for source citations, and HTML. LangChain integration available. Python, Node.js, Java SDKs ([quick start](#get-started-in-30-seconds) | [LangChain](#langchain-integration))\n\n♿ **PDF accessibility automation** — Auto-tag untagged PDFs into screen-reader-ready Tagged PDFs at scale. First open-source tool to generate Tagged PDFs end-to-end.\n\n- **What's the problem?** — Accessibility regulations are now enforced worldwide. Manual PDF remediation costs $50–200 per document and doesn't scale ([regulations](#pdf-accessibility--
FAQ (5)
トラブル対応--quietフラグを使用しない場合、opendataloader-pdfはなぜ出力を2回表示するのですか?
バグにより、--quietオプションが設定されていない場合にstdout出力が重複して出力されます。この修正では、ストリーミングモードでPromiseを空文字列で解決することで、CLIが二重書き込みをするのを防ぎます。最新版のopendataloader-pdfにアップデートするか、PR #399の変更を手動で適用してください。src/index.tsのexecuteJar関数内で、resolve呼び出しをresolve(streamOutput ? '' : stdout)に変更してください。
トラブル対応OpenDataLoaderPDF.processFileの後にPDFを削除しようとすると、「The file cannot be deleted because it is being used by another process」というエラーで失敗するのはなぜですか?
OpenDataLoader 2.2.1では、処理後にPDF PDDocumentおよび関連リソースが適切にクローズされず、アクティブなファイルロックが残ります。これを修正するには、リソースクリーンアップメソッドを追加し、既存のprocessFileロジックをtry-finallyブロックでラップします。DocumentProcessor.javaに以下を実装してください:
// Add this method
private static void closePdfResources() {
try {
StaticLayoutContainers.closeContrastRatioConsumer();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to close contrast ratio consumer: " + e.getMessage());
}
PDDocument document = StaticResources.getDocument();
if (document != null) {
try {
document.close();
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to close PDF document: " + e.getMessage());
}
}
}
// Wrap processFile body in try-finally
public static void processFile(String inputPdfName, Config config) throws IOException {
try {
// ... original code ...
} finally {
closePdfResources();
}
}
この修正を適用後、ファイルは処理直後に削除できるようになります。
トラブル対応元のPDFファイル名にスペースが含まれている場合、生成されたmarkdown内で画像が表示されないのはなぜですか?
マークダウンコンバータは、エスケープされていないスペースを含む画像リンクを生成し、その結果、レンダラは最初のスペースでパスを切り詰めます(例:)。これを修正するには、画像パスをangle bracketsで囲みます:。これはCommonMark §6.4に準拠しており、VS Code、GitHub、およびほとんどのレンダラで画像が正しく表示されることを保証します。この修正はコミット4b87a30(PR #468)に含まれています。
トラブル対応opendataloader_pdf を使用して PDF を変換する際に、「subprocess.CalledProcessError: returned non-zero exit status 1」を修正する方法
このエラーは、特定のPDF(例:QuarkXPressで生成されたファイル)を処理する際の画像抽出ロジックのバグによって発生します。このバグは新しいリリースで修正されました。pipを使用してopendataloader_pdfを最新バージョン(v2.0.3以降)にアップグレードしてください:pip install --upgrade opendataloader_pdf
トラブル対応numpy >= 2.0 を docling やハイブリッドライブラリで使用するとエラーが発生するのはなぜですか?
このプロジェクトは既に numpy >= 2.0 をネイティブでサポートしています(lockfiles 内の numpy 2.2.6/2.4.2 で確認済み)。エラーが発生した場合、以前に numpy < 2 に固定されていた docling や easyocr などの推移的依存関係の古いインストールが原因である可能性が高いです。修正するには、最初から再インストールしてください:pip install --upgrade --force-reinstall docling または pip install --no-cache-dir docling[easyocr]。すべてのパッケージが更新されていることを確認してください。問題が解決しない場合は、pip list で解決された依存関係のバージョンを確認し、traceback、Python version、インストール方法を報告してください。