Command Line

Convert a single file to Markdown:

doc2mark report.pdf

Write to a file:

doc2mark report.pdf -o report.md

Convert a directory:

doc2mark documents/ -o converted/ -r

JSON output uses the same structure as ProcessedDocument.to_dict():

doc2mark report.pdf --format json

Write both Markdown and JSON:

doc2mark report.pdf --format both -o report

OCR is disabled by default in the CLI. Enable it explicitly:

doc2mark scan.pdf --ocr openai --ocr-images
doc2mark scan.pdf --ocr tesseract --ocr-images
doc2mark scan.pdf --ocr vertex_ai --ocr-images

Useful options:

doc2mark docs/ -r --pattern "*.pdf" --parallel 4
doc2mark docs/ --exclude "*.tmp" --max-files 10
doc2mark report.pdf --include-metadata --max-length 5000