pdf2md
A blazing fast, layout-aware PDF to Markdown converter built with Rust. Uses DocLayoutNet YOLO-based detection to preserve document structure — images, tables, formulas, captions, headers and more. Pre-built binaries available for macOS, Linux and Windows. Also offers a free online tool and API at pdf2md.deepdiy.net.
A Rust CLI that converts PDF files into clean Markdown using a YOLO layout detection model, preserving headings, tables, formulas, and images.
pdf2md is a command-line tool that turns PDF files into Markdown text while trying to keep the original page layout intact. It is written in Rust and uses a YOLO-based detection model called DocLayoutNet to figure out which parts of a page are headings, paragraphs, tables, lists, formulas, captions, page headers, footnotes, or images. The output is meant to read cleanly, with no random line breaks chopping up paragraphs.
The project ships ready-to-run binaries for macOS on Apple Silicon, Linux on x86_64 and ARM64, and Windows on x86_64, so most users do not need to compile anything. You copy the binary and the model folder into a working directory, then run a command like ./pdf2md- input.pdf and get a Markdown file. Options let you set the detection DPI, the image export DPI, pick a single page, point at a different model folder, or export the full page image used for layout detection. Embedded images are pulled out of the PDF and saved next to the Markdown file.
For people who prefer a browser, there is a small Streamlit web app in the repo that wraps the binary and shows the converted Markdown with images. The README says the tool runs comfortably on a 1-core, 1 GB RAM VPS with no Docker required.
There is also a free public API at pdf2md.deepdiy.net that accepts a PDF over HTTP POST and returns Markdown, image links, and a downloadable ZIP. No API key is needed. The server handles one job at a time and returns HTTP 429 if it is busy, with a 20 MB size limit and a 120 second per-task limit. The project is released under the MIT license.
Where it fits
- Convert a PDF report into Markdown with figures saved alongside
- Run the prebuilt binary on a 1GB VPS to host a tiny PDF conversion service
- Wrap the CLI with the included Streamlit app for a browser based PDF to Markdown tool
- Call the public pdf2md API to get Markdown and a ZIP from any PDF without an API key