{"id":50958278,"url":"https://github.com/deepdiy/pdf2md","last_synced_at":"2026-06-18T10:02:46.318Z","repository":{"id":358596801,"uuid":"1241957686","full_name":"deepdiy/pdf2md","owner":"deepdiy","description":"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.","archived":false,"fork":false,"pushed_at":"2026-05-18T04:40:08.000Z","size":38094,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-18T06:45:18.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deepdiy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-18T02:11:56.000Z","updated_at":"2026-05-18T05:12:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/deepdiy/pdf2md","commit_stats":null,"previous_names":["deepdiy/pdf2md"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deepdiy/pdf2md","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepdiy%2Fpdf2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepdiy%2Fpdf2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepdiy%2Fpdf2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepdiy%2Fpdf2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deepdiy","download_url":"https://codeload.github.com/deepdiy/pdf2md/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deepdiy%2Fpdf2md/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34485169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-18T10:02:45.368Z","updated_at":"2026-06-18T10:02:46.313Z","avatar_url":"https://github.com/deepdiy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blazing Fast PDF to Markdown Converter\n\nConvert PDF to Markdown with layout detection — preserving images, tables, formulas, captions, headers, and footnotes. Built with Rust, NCNN, and MuPDF for maximum performance.\n\n**Try the free online converter:** [pdf2md.deepdiy.net](https://pdf2md.deepdiy.net/)\n\n## Features\n\n- **Layout-aware Markdown** — Uses DocLayoutNet YOLO-based detection to understand document structure. Output preserves headings, paragraphs, tables, lists, formulas, captions, and more in proper reading order.\n- **Images \u0026 Assets** — Automatically extracts embedded images and saves them alongside the Markdown output.\n- **Clean Output** — No unnecessary line breaks within paragraphs. Produces readable, well-formatted Markdown.\n- **Self-hostable** — Pre-built binaries for macOS, Linux, and Windows. No Docker or external services required.\n- **Free Web API** — No API key needed. Send a PDF and get back Markdown, image links, and a ZIP download.\n\n## Performance Comparison\n\n![PDF2MD performance comparison vs competitors — 10x faster on a 1c1g VPS](./assets/competitor-comparison.png)\n*Faster than other PDF to Markdown tools on equivalent hardware.*\n\n![Self-host on a 1c1g VPS with no Docker required](./assets/self-host-1c1g-vps.png)\n*Runs efficiently on a 1-core 1GB RAM VPS.*\n\n![Layout-aware Markdown preserves document structure including tables, lists, and headings](./assets/layout-aware-markdown.png)\n*DocLayoutNet detection keeps the original layout intact.*\n\n![Clean Markdown without unnecessary line breaks inside paragraphs](./assets/clean-markdown-no-line-breaks.png)\n*No broken inline text — every paragraph stays together.*\n\n![Free web service API for PDF to Markdown conversion](./assets/free-web-service-api.png)\n*No sign-up required. Upload and convert instantly.*\n\n## Pre-built Binaries\n\nDownload pre-compiled binaries for 4 platforms from the `dist/` directory:\n\n| Platform | Binary |\n|----------|--------|\n| macOS (Apple Silicon) | `dist/pdf2md-macos-arm64` |\n| Linux (x86_64) | `dist/pdf2md-x86_64-unknown-linux-gnu` |\n| Linux (ARM64) | `dist/pdf2md-aarch64-unknown-linux-gnu` |\n| Windows (x86_64) | `dist/pdf2md-win10-x64.exe` |\n\n### Step 1 — Move files to your working directory\n\n```bash\nmv dist/pdf2md-\u003cplatform\u003e \u003cworkdir\u003e/\nmv yolo26n-doclaynet_ncnn_model/ \u003cworkdir\u003e/\n```\n\n### Step 2 — Run conversion\n\n```bash\ncd \u003cworkdir\u003e\n./pdf2md-\u003cplatform\u003e \u003cinput.pdf\u003e\n```\n\nExport full-page layout input images:\n\n```bash\n./pdf2md-\u003cplatform\u003e \u003cinput.pdf\u003e [output.md] --export-page-image\n```\n\n### Arguments\n\n| Argument | Description |\n|----------|-------------|\n| `input.pdf` | Input PDF file |\n| `output.md` | Output Markdown file (optional, defaults to stdout) |\n\n### Extra options\n\n| Option | Description |\n|--------|-------------|\n| `--asset-dir DIR` | Directory to export page assets |\n| `--detect-dpi N` | DPI for layout detection (default: `72`) |\n| `--asset-dpi N` | DPI for asset export (default: `150`) |\n| `--page N` | Process only the specified page |\n| `--model-dir PATH` | Path to the model directory (default: `./yolo26n-doclaynet_ncnn_model/`) |\n| `--export-page-image` | Export the full page image used as layout detection input; increase `--detect-dpi` if you need higher-resolution page images |\n\n## Build from Source\n\n```bash\ncargo build --release --bin pdf2md\n```\n\nThe compiled binary will be at `target/release/pdf2md`.\n\n## Run from Source\n\n```bash\ncargo run --release --bin pdf2md -- ./input.pdf ./output.md\n```\n\n## Self Hosting Streamlit App\n\nA browser-based UI for uploading PDFs and previewing Markdown output with images.\n\nThe app automatically detects your OS and architecture to find the right binary in `dist/`. You can also specify a custom path:\n\n```bash\npip install streamlit\nstreamlit run streamlit_app.py\n```\n\nSpecify a custom binary or model directory:\n\n```bash\nstreamlit run streamlit_app.py -- \\\n  --pdf2md-bin ./dist/pdf2md-\u003cplatform\u003e \\\n  --model-dir /path/to/yolo26n-doclaynet_ncnn_model\n```\n\n## Free PDF to Markdown API\n\nNo API key required. Submit a PDF and receive Markdown, extracted images, and a downloadable ZIP.\n\n**Endpoint**\n\n```bash\nPOST https://pdf2md.deepdiy.net/v1/convert\nContent-Type: application/pdf\n```\n\n**curl example**\n\n```bash\ncurl -X POST \"https://pdf2md.deepdiy.net/v1/convert\" \\\n  -H \"Content-Type: application/pdf\" \\\n  --data-binary @paper.pdf\n```\n\n**Success response**\n\n```json\n{\n  \"status\": \"succeeded\",\n  \"markdown\": \"# Paper title\\n\\nConverted Markdown...\",\n  \"images\": [\n    {\n      \"path\": \"assets/page_0001_order_0001_class_6.png\",\n      \"url\": \"https://...\"\n    }\n  ],\n  \"zip_url\": \"https://...\",\n  \"download_url\": \"https://...\",\n  \"expires_in\": 300\n}\n```\n\n**Error response** (HTTP 429)\n\n```json\n{\n  \"error\": \"busy\"\n}\n```\n\n\u003e The system processes one request at a time across all users. If the server is busy, it returns HTTP 429. Wait 1 second and retry. Each conversion runs for up to 120 seconds — you will likely get a slot within that window.\n\n### API Limits\n\n| Item | Value |\n|------|-------|\n| Price | Free |\n| Max PDF size | 20 MB |\n| Concurrency | One request at a time (returns 429 if busy) |\n| Max task duration | 120 seconds |\n| Conversion timeout | 150 seconds |\n| Request timeout | 180 seconds |\n| ZIP download expiry | 5 minutes |\n\n## Detection Classes\n\nYou can use these class IDs to filter or block specific elements (e.g., Page-header, Footnote) from the output:\n\n`0`: Caption, `1`: Footnote, `2`: Formula, `3`: List-item, `4`: Page-footer, `5`: Page-header, `6`: Picture, `7`: Section-header, `8`: Table, `9`: Text, `10`: Title\n\n## License\n\nMIT License. See [`LICENSE`](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepdiy%2Fpdf2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeepdiy%2Fpdf2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeepdiy%2Fpdf2md/lists"}