Quick start¶
This page walks through the common tasks. The examples assume vexy-pdf3md is on
your PATH. From a checkout, prefix each command with uv run.
Convert one PDF¶
-
Run the tool on the file:
-
Read the JSON report on stdout.
"ok": truemeans the conversion succeeded or was skipped.
Result: book.md is written beside book.pdf.
If book.md already exists, the file is skipped and reported with
"status": "skipped". Add --overwrite=True to replace it.
Choose the output file¶
Result: results/renamed.md. For a single input file, --output may also be an
existing folder; the file is then written as FOLDER/book.md.
Convert a folder tree¶
The tool finds every file ending in .pdf (any letter case) under ./pdfs, and
writes each Markdown file to the same relative path under ./markdown:
Up to four PDFs are converted at the same time. Omit --output to write each
Markdown file next to its PDF.
Export images¶
Result:
book.md ends with a ## Media section that links each PNG. Use --media=pages to
render whole pages, including vector artwork, instead of only raster images. See
Output layout and media.
Compare converters¶
Result: book.markit.md and book.pymupdf.md, one per strategy. Use
--strategies=all to run all five. Add --fallback=False when you want each file
to come only from the named converter.
Convert a scan¶
This OCRs pages 1, 2, 3 and 5 with Tesseract, using Polish and English models, at
200 dpi. In automatic mode you usually do not need --strategies: a PDF whose pages
look scanned is routed to an OCR converter. See
Strategies and fallback.
Use the Python API¶
from vexy_pdf3md import convert
batch = convert("pdfs", "markdown", strategies="auto", media=True, workers=4)
print(batch.ok)
for item in batch.results:
print(item.input, item.output, item.status, item.strategy)
See Python API.
Run the bundled example¶
From a checkout:
The script creates a one-page PDF in a temporary folder, converts it with
strategies="pymupdf" and media="pages", and checks that the text and the page
image were written. It prints: