PDF to Markdown
This project contains a command line tool to convert PDF and Word documents to markdown. It uses image conversion and an LLM to convert the images to markdown.
Install
Execute these commands in the base directory of this project.
On Windows download the poppler library (e.g. poppler-24.08.0) from here and then do this using PowerShell:
$env:PKG_CONFIG_PATH="<download_folder>\poppler-24.08.0\Library\lib\pkgconfig"
uv venv
.venv\Scripts\activate
pip install cmake
uv sync
# conda remove -n pdf_to_markdown --all
uv venv
source .venv/bin/activate
uv sync
# Linux
sudo apt update
sudo apt install g++ -y
sudo apt install pkg-config -y
sudo apt-get install poppler-utils libpoppler-cpp-dev
# End Linux
There is an installation script for Linux in this repository.
Configuration
The application is configured used environment variables which you can set in an .env file. Check the .env_local file for the names of the variables that you will need.
You will need an Open AI key to run the PDF conversion.
You will also need a Gemini API key.
So you will need two environment variables:
OPENAI_API_KEY GEMINI_API_KEY
Usage of the command line application
Example: how to convert multiple pdf files with the OpenAI engine:
python ./pdf_to_markdown_llm/main/cli.py convert-files -f ./pdfs/oecd/002b3a39-en.pdf -f ./pdfs/oecd/ee6587fd-en.pdf
Example: how to convert a Word file to markdown with the OpenAI engine:
python ./pdf_to_markdown_llm/main/cli.py convert-files -f "./docs/Explainability March 2025.docx"
Example: how to convert a Word file to html with the OpenAI engine:
python ./pdf_to_markdown_llm/main/cli.py convert-files -f "./docs/bk/Pour INSCRIPTION en ligne MARCORIGNAN .docx" -t html
Example: how to convert a single file with Gemini model:
python ./pdf_to_markdown_llm/main/cli.py convert-files -f ./pdfs/oecd/002b3a39-en.pdf -e gemini
Example: how to convert all pdf files in a folder:
python ./pdf_to_markdown_llm/main/cli.py convert-in-dir --dirs ./pdfs/oecd
Publishing
uv build
uv publish
Note about upgrading libraries
uv lock --python 3.14 --upgrade-package pydantic-core --upgrade-package pydantic
Metadata
Release files for pdf-to-markdown-llm 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdf_to_markdown_llm-0.1.18.tar.gz | 13.4 kB | Without provenance | Details for pdf_to_markdown_llm-0.1.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdf_to_markdown_llm-0.1.18-py3-none-any.whl | Python 3 | none | any | Details for pdf_to_markdown_llm-0.1.18-py3-none-any.whl |
Total release size: 32.9 kB
Release files / pdf_to_markdown_llm-0.1.18.tar.gz
| Download URL | pdf_to_markdown_llm-0.1.18.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a5d07e525c165d16271cc7b7ce1fce197f956e9413efb606c2218e38e154f94
|
|
BLAKE2b-256 checksum How to use checksums |
45808e8986ff8c6091cd2c17b33351e79a6fd5e9ef5b7778fab24d8e8617b242
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pdf_to_markdown_llm-0.1.18-py3-none-any.whl
| Download URL | pdf_to_markdown_llm-0.1.18-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20adbcb71e3eaa6d632e0e01d5bc8e9f97f0b664882c828f3147facf668435d6
|
|
BLAKE2b-256 checksum How to use checksums |
6edae1bdefd5525b16e12efed07f101b963f512208f4f14a16f81a4766f41a5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pdf-to-markdown-llm 0.1.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.