PDFをMarkdownに変換
BasicStarter
ローカルのPDFを構造化Markdownに変換します。
docling convert report.pdf --to md
フラグ、出力、ヒント
使用するフラグ
--to md 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
# Annual Report
## Revenue
| Year | Revenue |
|------|--------:|
| 2025 | $12M |
| 2026 | $15M |
バリエーション
デジタル PDF で OCR をスキップ(大幅に高速)
docling convert report.pdf --to md --no-ocr
フォルダに直接書き込む
docling convert report.pdf --to md --output ./out
よくある間違い: スキャンした PDF で実行して空のテキストになる。PDF にテキスト層がない場合は --ocr-mode full_page を追加します。
オンライン文書をHTTP URLから直接ダウンロードして変換します。
docling convert https://arxiv.org/pdf/2408.09869 --to md
フラグ、出力、ヒント
使用するフラグ
--to md 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
## Docling Technical Report
The conversion pipeline analyses layout, reading order and tables…
バリエーション
リクエストヘッダーを送信(auth / token)
docling convert https://example.com/report.pdf --headers '{"Authorization":"Bearer TOKEN"}' --to md
代わりに JSON をエクスポート
docling convert https://arxiv.org/pdf/2408.09869 --to json
よくある間違い: どの URL でも動くと想定する。ソースは HTTP(S) 経由で到達可能な対応ドキュメント形式である必要があります。
バウンディングボックスを含むDoclingDocumentのJSONスキーマを出力します。
docling convert report.pdf --to json
フラグ、出力、ヒント
使用するフラグ
--to json 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
{
"schema_name": "DoclingDocument",
"texts": [ ... ],
"tables": [ ... ],
"pictures": [ ... ]
}
バリエーション
速度のために OCR をスキップ
docling convert report.pdf --to json --no-ocr
画像を base64 として埋め込む
docling convert report.pdf --to json --image-export-mode embedded
よくある間違い: CLI の JSON と export_to_dict() がバイト単位で同一だと期待する。両者は同じドキュメントの等価な表現です。
インストール済みバージョンを確認
BasicStarter
Docling、docling-core、docling-ibm-models のバージョンを表示します。
docling --version
フラグ、出力、ヒント
使用するフラグ
--version インストールされている Docling のバージョンを表示します。
期待される出力
Docling version: 2.129.0
Docling Core version: 2.x.x
Docling IBM Models version: 3.x.x
Python: cpython-312 …
バリエーション
最新リリースにアップグレード
pip install -U docling docling-core docling-ibm-models
よくある間違い: バージョン出力なしで不具合を報告する。リリース間でフラグが変わるため、常に含めてください。
インストール済み Docling バージョンが対応するすべてのフラグを CLI から直接一覧表示します。
docling convert --help
フラグ、出力、ヒント
期待される出力
Usage: docling convert [OPTIONS] SOURCE
--from TEXT Input formats to accept…
--to TEXT Output formats…
--ocr-engine TEXT The OCR engine to use…
バリエーション
トップレベルのコマンドを一覧表示
docling --help
リモートコンバーターを確認
docling convert-remote --help
よくある間違い: 古いブログ記事を信用する。インストール済みバージョンのフラグは常に --help で確認してください。
変換したファイルを現在のディレクトリではなく指定した出力ディレクトリに書き込みます。
docling convert report.pdf --to md --output ./out
フラグ、出力、ヒント
使用するフラグ
--output 結果を保存するディレクトリ(ファイル名ではありません)。
バリエーション
複数の形式を一度にエクスポート
docling convert report.pdf --to md --to json --to html --output ./out
よくある間違い: --output がファイル名ではなくディレクトリを取ることを忘れる。--to と組み合わせて拡張子を選びます。
複数の形式を一度にエクスポート
OutputIntermediate
--to フラグは繰り返し可能です。1 回の実行で Markdown、JSON、HTML を生成します。
docling convert report.pdf --to md --to json --to html
フラグ、出力、ヒント
使用するフラグ
--to 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
report.md report.json report.html
バリエーション
すべてを 1 つのフォルダに
docling convert report.pdf --to md --to json --output ./out
よくある間違い: カンマ区切りのリストを渡す(--to md,json)。代わりにフラグを繰り返します。
フォルダ全体を変換
BasicIntermediate
Docling にディレクトリを指定すると、その中の対応ドキュメントをすべて走査します。
docling convert ./inbox --output ./out
フラグ、出力、ヒント
使用するフラグ
--output 結果を保存するディレクトリ(ファイル名ではありません)。--abort-on-error 最初のファイルが失敗した時点で実行全体を停止します。
期待される出力
Converting ./inbox/a.pdf … done
Converting ./inbox/b.docx … done
バリエーション
1 つのファイルが失敗しても続行
docling convert ./inbox --output ./out --no-abort-on-error
1 つの形式に絞り込む
docling convert ./inbox --from pdf --output ./out
よくある間違い: サブフォルダへの再帰が常に望ましいと想定する。大きな実行の前に出力されたファイル一覧を確認してください。
名前付きの複数ファイルを変換
BasicIntermediate
1 つのコマンドで複数のパスを渡します。それぞれが独立して変換されます。
docling convert a.pdf b.docx c.pptx --output ./out
フラグ、出力、ヒント
使用するフラグ
source Accepts one or more local paths, directories or URLs.
期待される出力
a.md b.md c.md written to ./out
バリエーション
URL を含む混在ソース
docling convert a.pdf https://example.com/b.pdf --output ./out
よくある間違い: グロブ(“*.pdf”)を引用してシェルが展開すると期待する。シェルに展開させるか、ディレクトリを渡します。
すべてのモデルを事前ダウンロード
OfflineIntermediate
オフライン利用の前にレイアウトと表のモデルをローカルにキャッシュします。
docling-tools models download --all
フラグ、出力、ヒント
使用するフラグ
--all Download every available model (large).
期待される出力
Downloading layout model…
Downloading tableformer model…
Models cached in $HOME/.cache/docling/models
バリエーション
必要なものだけをダウンロード
docling-tools models download layout tableformer rapidocr
HuggingFace リポジトリをダウンロード
docling-tools models download-hf-repo docling-project/docling-models
よくある間違い: 従量制接続で --all をダウンロードする。使用する特定のモデルを選んでください。
DOCXをMarkdownに変換
ConversionStarter
Microsoft Word文書をMarkdownに解析します。
docling convert contract.docx --to md
フラグ、出力、ヒント
使用するフラグ
--to md 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
# Service Agreement
1. Scope
2. Payment terms…
バリエーション
レガシー .doc ファイル
docling convert contract.doc --to md
よくある間違い: OCR オプションが効くと期待する。Office 形式はネイティブに解析されるため --ocr-engine は効果がありません。
PPTXをMarkdownに変換
ConversionStarter
PowerPointのスライド、テキストボックス、発表者ノートを解析します。
docling convert slides.pptx --to md
フラグ、出力、ヒント
使用するフラグ
--page-range 指定したページ範囲のみを変換します。PDF、XLSX、PPTX が対応します。
期待される出力
## Slide 1 — Overview
Bullet one
Bullet two
バリエーション
最初の 10 枚のスライドのみ
docling convert slides.pptx --page-range 1-10 --to md
よくある間違い: スライド内の画像が説明されると想定する。そのためには --enrich-picture-description を追加します。
XLSXをMarkdownに変換
ConversionStarter
Excelブックをシートごとの構造化テーブルに解析します。
docling convert workbook.xlsx --to md
フラグ、出力、ヒント
使用するフラグ
--page-range 指定したページ範囲のみを変換します。PDF、XLSX、PPTX が対応します。
期待される出力
## Sheet 1
| Region | Q1 | Q2 |
|--------|----|----|
| EMEA | 12 | 15 |
バリエーション
ロスレス構造
docling convert workbook.xlsx --to json
よくある間違い: XLSX を PDF のように扱って OCR を有効にする。スプレッドシートには既定でビットマップページがありません。
HTMLをMarkdownに変換
ConversionStarter
ローカルのHTMLページをMarkdownに解析します。
docling convert page.html --to md
フラグ、出力、ヒント
使用するフラグ
--html-image-fetch HTML および EPUB 入力が参照する画像を取得します。
期待される出力
# Page title
Body text converted from HTML…
バリエーション
リモート画像もダウンロード
docling convert page.html --html-image-fetch remote --to md
よくある間違い: 画像の取得が既定でオフであることを忘れる。画像が必要な場合は --html-image-fetch を渡します。
CSV を Markdown に変換
ConversionStarter
カンマ区切りのデータを Markdown テーブルに変換します。
docling convert data.csv --to md
フラグ、出力、ヒント
使用するフラグ
--to md 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
| name | score |
|------|------:|
| Ada | 98 |
バリエーション
構造化 JSON として保持
docling convert data.csv --to json
よくある間違い: カンマ/標準 CSV 方言以外の区切り文字を使う。まず正規化してください。
EPUB を Markdown に変換
ConversionIntermediate
章構造を保ちながら電子書籍や長文 EPUB コンテンツを変換します。
docling convert book.epub --to md
フラグ、出力、ヒント
使用するフラグ
--html-image-fetch HTML および EPUB 入力が参照する画像を取得します。
期待される出力
# Chapter 1
Long-form text…
バリエーション
挿絵を含める
docling convert book.epub --html-image-fetch all --to md
よくある間違い: 画像を取得せず、図が欠けている理由を不思議に思う。
Markdown を HTML に変換
ConversionIntermediate
Markdown ファイルを再処理し、クリーンな HTML をエクスポートします(表とコードを保持)。
docling convert notes.md --to html
フラグ、出力、ヒント
使用するフラグ
--to html 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
<h1>Notes</h1>
<p>…</p>
バリエーション
長いページを分割
docling convert notes.md --to html_split_page
よくある間違い: 画像ファイルが生成されると期待する。HTML エクスポートはボックスを参照するだけで、新しい画像を描画しません。
LaTeX を Markdown に変換
ConversionAdvanced
LaTeX ソースを解析し、オプションで TikZ 図をレンダリングします。
docling convert paper.tex --to md
フラグ、出力、ヒント
使用するフラグ
--tikz-engine Set to 'tectonic' to rasterize tikzpicture diagrams.
期待される出力
# Introduction
The math is preserved as LaTeX where possible…
バリエーション
TikZ 図を画像としてレンダリング
docling convert paper.tex --tikz-engine tectonic --to md
よくある間違い: Tectonic がない、または失敗すると、TikZ レンダリングは黙ってソースを保持するフォールバックをします。
テキストを含む PNG/JPEG/TIFF 画像を OCR で Markdown に変換します。
docling convert scan.png --to md --ocr-mode full_page
フラグ、出力、ヒント
使用するフラグ
--ocr-mode full_page どの文書領域を OCR エンジンに渡すか。--ocr-engine OCR エンジンのプロバイダー。
期待される出力
Text recognised from the image…
バリエーション
RapidOCR を使用
docling convert scan.png --ocr-engine rapidocr --to md
よくある間違い: 低 DPI の写真で既定の OCR モードを使う。精度を上げるには解像度を高くしてください。
画像のみのページに全ページOCRを強制します。
docling convert scan.pdf --ocr-mode full_page --to md
フラグ、出力、ヒント
使用するフラグ
--ocr-mode full_page どの文書領域を OCR エンジンに渡すか。
期待される出力
Text reconstructed from the scanned page images…
バリエーション
同時にエンジンを選ぶ
docling convert scan.pdf --ocr-mode full_page --ocr-engine rapidocr --to md
よくある間違い: デジタル PDF で OCR をオンのままにすると時間を浪費する。テキスト層がない、または誤っている場合にのみ強制します。
OCRエンジンを選ぶ
OCRIntermediate
特定のエンジンでOCRを実行します(例: RapidOCR)。
docling convert scan.pdf --ocr-engine rapidocr --to md
フラグ、出力、ヒント
使用するフラグ
--ocr-engine OCR エンジンのプロバイダー。
期待される出力
Using OCR engine: rapidocr
バリエーション
言語を指定した Tesseract
docling convert scan.pdf --ocr-engine tesseract --ocr-lang eng --to md
macOS の Apple Vision
docling convert scan.pdf --ocr-engine ocrmac --to md
よくある間違い: インストールされていないエンジンを選ぶ。RapidOCR が最も安全なクロスプラットフォームの既定です。
指定した言語で OCR
OCRIntermediate
OCR エンジンに想定する言語を伝え、精度を大幅に向上させます。
docling convert scan.pdf --ocr-engine tesseract --ocr-lang deu,fra --to md
フラグ、出力、ヒント
使用するフラグ
--ocr-lang OCR 言語。エンジン固有のコード、または iso: を付けた BCP-47 タグを使用します。
期待される出力
Using OCR languages: deu, fra
バリエーション
BCP-47 経由の簡体字中国語
docling convert scan.pdf --ocr-engine rapidocr --ocr-lang iso:zh-Hans --to md
エンジンに自動検出させる
docling convert scan.pdf --ocr-lang '' --to md
よくある間違い: エンジンの慣習を混在させる。各エンジンには独自のコードがあります。正規の BCP-47 タグには iso: を付けます。
OCRを無効化(デジタルPDF)
OCRStarter
テキスト層があるPDFではOCRを省略します。
docling convert report.pdf --no-ocr --to md
フラグ、出力、ヒント
使用するフラグ
--no-ocr Turn OCR off; the embedded text layer is used as-is.
期待される出力
Skipping OCR (digital text layer detected)…
バリエーション
不要な表もスキップ
docling convert report.pdf --no-ocr --no-tables --to md
よくある間違い: スキャンに --no-ocr を使う。空またはほぼ空の出力になります。
レイアウト領域のみを OCR
OCRAdvanced
ページ全体ではなく検出されたレイアウト領域のみに OCR を実行します。
docling convert report.pdf --ocr-mode layout_regions --to md
フラグ、出力、ヒント
使用するフラグ
--ocr-mode layout_regions どの文書領域を OCR エンジンに渡すか。
期待される出力
OCR applied to detected layout regions…
バリエーション
PDF 対応の領域選択
docling convert report.pdf --ocr-mode pdf_aware_layout_regions --to md
よくある間違い: ページ全体が 1 枚の写真なのに領域モードを使う。その場合は full_page を使用します。
Tesseract のページ分割モードを設定
OCRAdvanced
ページ分割モード(0-13)で Tesseract のレイアウト解析を微調整します。
docling convert scan.pdf --ocr-engine tesseract --psm 6 --to md
フラグ、出力、ヒント
使用するフラグ
--psm Tesseract エンジンの Page Segmentation Mode。
期待される出力
Tesseract PSM 6 — assume a single uniform block of text.
バリエーション
1 行のテキスト
docling convert scan.pdf --ocr-engine tesseract --psm 7 --to md
よくある間違い: 無視される非 Tesseract エンジンに PSM を設定する。
より高速な表抽出
TablesIntermediate
高精度モデルの代わりに高速な表モードを使います。
docling convert report.pdf --table-mode fast --to md
フラグ、出力、ヒント
使用するフラグ
--table-mode 表構造モデルの精度と速度のトレードオフ。
期待される出力
Rough table grid, produced faster…
バリエーション
表を完全にスキップ
docling convert report.pdf --no-tables --to md
よくある間違い: 結合セルのある財務シートで fast を使う。精度が目に見えて低下します。
表の抽出を無効化
TablesIntermediate
本文テキストのみが必要な場合は表構造モデルをスキップします。
docling convert report.pdf --no-tables --to md
フラグ、出力、ヒント
使用するフラグ
--no-tables Do not run the table structure model.
期待される出力
Tables rendered as plain text flow…
バリエーション
最速のデジタルテキスト経路
docling convert report.pdf --no-ocr --no-tables --to md
よくある間違い: 表が重要なのに有効にする。表の内容が段落に崩れます。
TableFormer v2 エンジンを使用
TablesAdvanced
新しい TableFormer v2 を含む特定の表構造エンジンを選択します。
docling convert report.pdf --table-structure-engine docling_tableformer_v2 --to md
フラグ、出力、ヒント
使用するフラグ
--table-structure-engine 表構造エンジンを選択します。
期待される出力
Using table structure engine: docling_tableformer_v2
バリエーション
Granite vision テーブルエンジン
docling convert report.pdf --table-structure-engine granite_vision_table --to md
よくある間違い: すべてのエンジンが同梱されていると想定する。一部は追加のモデルダウンロードやプラグインが必要です。
コードと数式のエンリッチを有効化
EnrichmentIntermediate
エンリッチメントモデルでLaTeX数式とコードブロックを抽出します。
docling convert paper.pdf --enrich-code --enrich-formula --to md
フラグ、出力、ヒント
使用するフラグ
--enrich-code コードブロックを検出してラベル付けします。--enrich-formula 数式を LaTeX として抽出します。
期待される出力
```python
def hello(): …
```
$$ E = mc^2 $$
バリエーション
数式のみ
docling convert paper.pdf --enrich-formula --to md
コードのみ
docling convert repo.pdf --enrich-code --to md
よくある間違い: コードや数式のないドキュメントで両方を有効にする。それぞれがニューラル処理を追加し、変換を遅くします。
VLM で画像を説明
EnrichmentAdvanced
図や画像の自然言語による説明を生成します。
docling convert report.pdf --enrich-picture-description --to md
フラグ、出力、ヒント
使用するフラグ
--enrich-picture-description 視覚モデルで画像の説明を生成します。
期待される出力
<!-- picture: a bar chart showing revenue growth from 2020 to 2026 -->
バリエーション
生成トークンを制限
docling convert report.pdf --enrich-picture-description --picture-description-max-new-tokens 256 --to md
よくある間違い: 十分な RAM/VRAM がない画像の多いドキュメントで実行する。視覚モデルを読み込みます。
分類モデルで画像をクラス(グラフ、図、スクリーンショット、写真など)ごとにラベル付けします。
docling convert report.pdf --enrich-picture-classes --to md
フラグ、出力、ヒント
使用するフラグ
--enrich-picture-classes 画像を分類します(グラフ、図、スクリーンショットなど)。
期待される出力
<!-- picture class: chart -->
バリエーション
分類と説明
docling convert report.pdf --enrich-picture-classes --enrich-picture-description --to md
よくある間違い: ピクセル単位で正確なラベルを期待する。軽量な分類器であり、完全な視覚モデルではありません。
RAG用チャンクを出力
RAGIntermediate
構造を保つHybridChunkerのチャンクを生成します。
docling convert report.pdf --to chunks --chunks-type hybrid
フラグ、出力、ヒント
使用するフラグ
--to chunks 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。--chunks-type --to chunks で使用するチャンカー種別。
期待される出力
{ "text": "…", "meta": { "headings": ["Revenue"] } }
バリエーション
チャンクサイズを制限
docling convert report.pdf --to chunks --chunks-max-tokens 512
階層チャンク
docling convert report.pdf --to chunks --chunks-type hierarchical
よくある間違い: Docling の構造認識チャンカーを使わず、素朴なスプリッターで Markdown エクスポートを分割する。
チャンクあたりの最大トークン数とハイブリッドチャンキングに使うトークナイザーを制御します。
docling convert report.pdf --to chunks --chunks-max-tokens 512
フラグ、出力、ヒント
使用するフラグ
--chunks-max-tokens チャンクあたりの最大トークン数。--chunks-tokenizer ハイブリッドチャンキングに使用するトークナイザー。
期待される出力
Chunks sized to the embedding model's token limit…
バリエーション
別の埋め込みモデルに合わせる
docling convert report.pdf --to chunks --chunks-tokenizer BAAI/bge-small-en-v1.5
よくある間違い: 埋め込みモデルが対応するより大きいチャンクサイズを設定する。切り詰められます。
Granite DoclingモデルでVLMパイプラインを使います。
docling convert report.pdf --pipeline vlm --vlm-model granite_docling --to md
フラグ、出力、ヒント
使用するフラグ
--pipeline vlm PDF および画像ファイルの処理パイプライン。--vlm-model --pipeline vlm で使用する VLM プリセット。
期待される出力
Markdown generated page-by-page by the vision model…
バリエーション
より小さな SmolDocling プリセット
docling convert report.pdf --pipeline vlm --vlm-model smoldocling --to md
生のモデル出力を保持
docling convert report.pdf --pipeline vlm --vlm-write-native-output
よくある間違い: VLM が常に優れていると想定する。単純なデジタル PDF では標準パイプラインの方が速く安価です。
VLM が 1 ページあたりに生成できる最大トークン数を上書きします。
docling convert report.pdf --pipeline vlm --vlm-max-new-tokens 8192 --to md
フラグ、出力、ヒント
使用するフラグ
--vlm-max-new-tokens VLM 生成の max_new_tokens を上書きします。
期待される出力
Long, dense pages no longer get cut off…
バリエーション
デバッグ用に生の出力を保持
docling convert report.pdf --pipeline vlm --vlm-write-native-output
よくある間違い: 非常に高密度なページで既定のままにすると、ページ出力が切り詰められることがあります。
音声・動画を文字起こし (ASR)
AudioIntermediate
WAV/MP3(および動画)をASRパイプラインで文字起こしします。
docling convert lecture.mp3 --pipeline asr --to md
フラグ、出力、ヒント
使用するフラグ
--pipeline asr PDF および画像ファイルの処理パイプライン。--asr-model 音声・動画ファイル用の ASR モデル。
期待される出力
00:00:00 — Welcome to the show…
バリエーション
より高い精度
docling convert lecture.mp3 --pipeline asr --asr-model whisper_medium --to md
字幕出力
docling convert lecture.mp3 --pipeline asr --to vtt
よくある間違い: 重要な文字起こしに既定の whisper_tiny を使う。精度には medium/large を選んでください。
動画を字幕に文字起こし
AudioIntermediate
動画の音声を文字起こしし、タイムスタンプ付きの WebVTT 字幕をエクスポートします。
docling convert talk.mp4 --pipeline asr --to vtt
フラグ、出力、ヒント
使用するフラグ
--to vtt 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
WEBVTT
00:00:00.000 --> 00:00:04.000
Hello and welcome…
バリエーション
別の ASR モデル
docling convert talk.mp4 --pipeline asr --asr-model whisper_small --to vtt
よくある間違い: OCR/表のフラグが適用されると期待する。動画は ASR パイプラインのみを使用します。
シーン変化で動画をサンプリング
AudioAdvanced
動画からフレームをサンプリングする方法を選択します。固定間隔またはシーン変化。
docling convert talk.mp4 --pipeline asr --video-sampling-mode scene
フラグ、出力、ヒント
使用するフラグ
--video-sampling-mode 動画フレームのサンプリング方法。--video-frame-interval 固定間隔モードでのフレーム間の秒数。
期待される出力
Frames sampled at scene changes…
バリエーション
より高密度の固定サンプリング
docling convert talk.mp4 --pipeline asr --video-frame-interval 5
よくある間違い: 単一の固定カメラでシーンモードを使う。そこでは固定間隔の方が予測しやすいです。
話者分離(誰が何を言ったか)
AudioAdvanced
音声/動画の文字起こしで話者をラベル付けします(resemblyzer extra が必要)。
docling convert interview.mp4 --pipeline asr --video-diarization
フラグ、出力、ヒント
使用するフラグ
--video-diarization 話者分離を有効にします(resemblyzer が必要)。
期待される出力
[SPEAKER_00] …
[SPEAKER_01] …
バリエーション
話者分離を明示的に無効化
docling convert interview.mp4 --pipeline asr --no-video-diarization
よくある間違い: 話者分離には resemblyzer 依存関係のインストールが必要なことを忘れる。
画像を PNG ファイルとしてエクスポート
OutputIntermediate
図を個別の PNG ファイルとして書き出し、出力ドキュメントから参照します。
docling convert report.pdf --to md --image-export-mode referenced --output ./out
フラグ、出力、ヒント
使用するフラグ
--image-export-mode JSON、YAML、HTML、Markdown 出力で画像をどのようにエクスポートするか。
期待される出力
./out/report.md + ./out/report_artifacts/*.png
バリエーション
画像の位置のみをマーク
docling convert report.pdf --to md --image-export-mode placeholder
base64 として埋め込む
docling convert report.pdf --to json --image-export-mode embedded
よくある間違い: --to json で referenced を使い、隣に PNG があると期待する。アーティファクトフォルダを確認してください。
DocTags をエクスポート
OutputAdvanced
モデル入力として使われるコンパクトなトークン風 DocTags マークアップを生成します。
docling convert report.pdf --to doctags
フラグ、出力、ヒント
使用するフラグ
--to doctags 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
<doctag><page_1><section_header_level_1>Annual Report</section_header_level_1>…
バリエーション
VLM ネイティブ出力付き
docling convert report.pdf --pipeline vlm --to doctags
よくある間違い: DocTags を Markdown のように扱う。モデル向けのコンパクトな内部表現です。
ページ分割 HTML をエクスポート
OutputAdvanced
ページごとに分割した HTML を生成します。ビューアーや並べたレビューに便利です。
docling convert report.pdf --to html_split_page --output ./out
フラグ、出力、ヒント
使用するフラグ
--to html_split_page 出力形式。フラグを繰り返すと複数の形式を一度にエクスポートできます。
期待される出力
./out/report_1.html report_2.html …
バリエーション
単一ファイル HTML
docling convert report.pdf --to html
よくある間違い: 分割出力がページごとに 1 つ書き出すのに、単一の HTML ファイルを探す。
検出したレイアウトを可視化
OutputAdvanced
検出した要素のバウンディングボックスを出力のページ画像に重ねます。
docling convert report.pdf --show-layout --to md --output ./out
フラグ、出力、ヒント
使用するフラグ
--show-layout 要素のバウンディングボックスをページ画像に重ねて表示します。
期待される出力
Page images with coloured layout boxes…
バリエーション
表のセルを可視化
docling convert report.pdf --debug-visualize-tables
よくある間違い: Markdown 自体にボックスが描かれると期待する。描かれるのはエクスポートされたページ画像です。
NVIDIA GPU(CUDA)で実行
PerformanceIntermediate
CUDA で推論を高速化し、スレッド/バッチ設定を調整します。
docling convert report.pdf --device cuda --num-threads 8 --to md
フラグ、出力、ヒント
使用するフラグ
--device cuda モデル推論のハードウェアアクセラレーター。--num-threads モデル推論に使用するスレッド数。
期待される出力
Using accelerator device: cuda
バリエーション
より大きなページバッチ
docling convert big.pdf --device cuda --page-batch-size 16
よくある間違い: CUDA ランタイムのないマシンで --device cuda を渡す。代わりに auto または cpu を使用します。
Apple Silicon(MPS)で実行
PerformanceIntermediate
M シリーズ Mac で Metal バックエンドを使い、推論を高速化します。
docling convert report.pdf --device mps --to md
フラグ、出力、ヒント
使用するフラグ
--device mps モデル推論のハードウェアアクセラレーター。
期待される出力
Using accelerator device: mps
バリエーション
Docling に選ばせる
docling convert report.pdf --device auto --to md
よくある間違い: MPS が専用 GPU に匹敵すると期待する。堅実な高速化であり、データセンター向けカードではありません。
ページバッチサイズを増やす
PerformanceAdvanced
1 バッチあたりのページ数を増やし、大きなドキュメントで GPU/CPU スループットを高めます。
docling convert big.pdf --page-batch-size 16 --to md
フラグ、出力、ヒント
使用するフラグ
--page-batch-size 1 バッチで処理するページ数。
期待される出力
Processing 16 pages per batch…
バリエーション
メモリ不足時に引き下げる
docling convert big.pdf --page-batch-size 2
よくある間違い: メモリ不足エラーが出るまで上げる。変換がクラッシュする場合は下げてください。
ドキュメントごとのタイムアウトを設定
PerformanceAdvanced
処理時間を制限し、1 つの問題ファイルからバッチを保護します。
docling convert ./inbox --document-timeout 120 --output ./out
フラグ、出力、ヒント
使用するフラグ
--document-timeout 各文書の処理タイムアウト。
期待される出力
Timed out after 120s — moving to the next file…
バリエーション
失敗時にバッチ全体を中止
docling convert ./inbox --abort-on-error --output ./out
よくある間違い: 巨大なドキュメントに非常に短いタイムアウトを設定し、誤った失敗を得る。
変換パイプラインをプロファイリング
PerformanceAdvanced
変換段階ごとの時間を集計し、ボトルネックを見つけます。
docling convert report.pdf --profiling --to md
フラグ、出力、ヒント
使用するフラグ
--profiling 各変換段階に費やした時間を集計します。--save-profiling Save profiling summaries to JSON.
期待される出力
layout: 3.2s ocr: 1.1s tableformer: 0.9s total: 5.4s
バリエーション
数値を JSON に保存
docling convert report.pdf --profiling --save-profiling
よくある間違い: -v をオンのままプロファイリングし、ログ時間をモデル時間と誤認する。
ページ範囲のみを変換
ConversionIntermediate
ドキュメント全体ではなく一部のページのみを解析します。
docling convert report.pdf --page-range 1-4 --to md
フラグ、出力、ヒント
使用するフラグ
--page-range 指定したページ範囲のみを変換します。PDF、XLSX、PPTX が対応します。
期待される出力
Converting pages 1-4 only…
バリエーション
単一ページ
docling convert report.pdf --page-range 3 --to md
よくある間違い: すべてのバックエンドが範囲を尊重すると期待する。主に PDF、XLSX、PPTX です。
パスワード保護された PDF を開く
ConversionAdvanced
パスワードを指定して暗号化 PDF を変換できるようにします。
docling convert locked.pdf --pdf-password 'secret' --to md
フラグ、出力、ヒント
使用するフラグ
--pdf-password 保護された PDF 文書のパスワード。
期待される出力
Decrypting and converting locked.pdf…
バリエーション
環境変数からパスワードを使用
docling convert locked.pdf --pdf-password "$PDF_PW" --to md
よくある間違い: 実際のパスワードをシェル履歴に入れる。環境変数を優先してください。
PDF バックエンドを切り替え
ConversionAdvanced
問題のある PDF に対して既定の docling-parse と pypdfium2 を選べます。
docling convert report.pdf --pdf-backend pypdfium2 --to md
フラグ、出力、ヒント
使用するフラグ
--pdf-backend docling_parse (default) or pypdfium2.
期待される出力
Using PDF backend: pypdfium2
バリエーション
既定のパーサー
docling convert report.pdf --pdf-backend docling_parse --to md
よくある間違い: フォントエンコーディングが壊れた PDF で既定のままにする。pypdfium2 を試してください。
カスタムモデルパスを使用
OfflineAdvanced
既定のキャッシュではなく、事前に用意したモデルディレクトリを Docling に指定します。
docling convert report.pdf --artifacts-path /opt/docling/models --to md
フラグ、出力、ヒント
使用するフラグ
--artifacts-path 事前ダウンロード済みモデルアーティファクトの場所。
期待される出力
Loading models from /opt/docling/models…
バリエーション
代わりに環境変数を使用
DOCLING_ARTIFACTS_PATH=/opt/docling/models docling convert report.pdf --to md
よくある間違い: 空のディレクトリを指す。Docling はダウンロードを試み、オフラインでは失敗することがあります。
完全オフライン(エアギャップ)で実行
OfflineAdvanced
接続されたホストでモデルを事前取得し、ネットワークなしで変換します。
export HF_HUB_OFFLINE=1; export DOCLING_ARTIFACTS_PATH=/opt/docling/models; docling convert report.pdf --to md
フラグ、出力、ヒント
使用するフラグ
DOCLING_ARTIFACTS_PATH Directory holding the pre-downloaded models.HF_HUB_OFFLINE Stop HuggingFace downloads and use the local cache only.
期待される出力
Conversion completes with no outbound requests…
バリエーション
HF キャッシュディレクトリを選択
export HF_HOME=/opt/docling/hf; docling convert report.pdf --to md
よくある間違い: HF_HUB_OFFLINE=1 を忘れると、Docling がネットワーク取得を試みて停止または失敗します。
Docling Serve APIを実行
ServerIntermediate
docling-serveのHTTP APIとUIをポート5001で起動します。
docling-serve run --enable-ui
フラグ、出力、ヒント
使用するフラグ
--enable-ui Serve the built-in web UI alongside the API.
期待される出力
Uvicorn running on http://0.0.0.0:5001 (docs at /docs)
バリエーション
Docker で実行
docker run -p 5001:5001 -e DOCLING_SERVE_ENABLE_UI=1 quay.io/docling-project/docling-serve
よくある間違い: 認証なしでサービスを公開する。プロキシと認証を前に置いてください。
リモートサービス経由で変換
ServerAdvanced
実行中の docling-serve インスタンスに変換をオフロードします(ローカルファイル、フォルダ、URL)。
docling convert-remote report.pdf --service-url http://localhost:5001 --to md
フラグ、出力、ヒント
使用するフラグ
--service-url Base URL of docling-serve (or DOCLING_SERVICE_URL).--api-key Optional API key (or DOCLING_SERVICE_API_KEY).
期待される出力
submitting job… polling… report.md written
バリエーション
認証済みサービス
docling convert-remote report.pdf --service-url https://docling.internal --api-key "$DOCLING_KEY" --to md
websocket の代わりにポーリングを使用
docling convert-remote report.pdf --service-url http://localhost:5001 --watcher polling --to md
よくある間違い: --device のようなローカル専用フラグを convert-remote に渡す。意図的に存在しません。
MCPサーバーを実行
MCPIntermediate
AIデスクトップクライアント向けのModel Context Protocolサーバーを起動します。
uvx --from=docling-mcp docling-mcp-server
フラグ、出力、ヒント
使用するフラグ
--from=docling-mcp 受け付ける入力形式を制限します。odt、ods、odp には 'odf' を使用します。
期待される出力
docling-mcp server ready (stdio)
バリエーション
AI クライアント用の JSON 構成
{"mcpServers": {"docling": {"command": "uvx", "args": ["--from=docling-mcp", "docling-mcp-server"]}}}
よくある間違い: クライアントの MCP 構成に JSON ブロックではなくコマンドを貼り付ける。
ログの冗長度を上げる
DebugIntermediate
進捗(-v)または完全なデバッグログ(-vv)を出力して変換を診断します。
docling convert report.pdf -vv --to md
フラグ、出力、ヒント
使用するフラグ
-v / --verbose Repeat for more detail: -v info, -vv debug.-q / --quiet Silence per-file progress (warnings and errors remain).
期待される出力
DEBUG docling.pipeline… loading layout model
バリエーション
スクリプト用の静かなバッチ
docling convert ./inbox --quiet --output ./out
よくある間違い: 本番で -vv をオンのままにする。デバッグログは遅く非常に冗長です。
セル、OCR、表を可視化
DebugAdvanced
デバッグビジュアライザーは各段階が検出した内容を描画し、調整とトラブルシューティングに役立ちます。
docling convert report.pdf --debug-visualize-tables
フラグ、出力、ヒント
使用するフラグ
--debug-visualize-layout レイアウトクラスターを可視化します。--debug-visualize-tables 表のセルを可視化します。--debug-visualize-ocr OCR セルを可視化します。--debug-visualize-cells Visualise PDF cells.
期待される出力
Annotated page images written next to the output…
バリエーション
OCR 検出を確認
docling convert scan.pdf --debug-visualize-ocr
レイアウトクラスターを確認
docling convert report.pdf --debug-visualize-layout
よくある間違い: 複数のビジュアライザーを同時に使い、圧倒的な数の画像を得る。