This release is a pre-release and may not be stable for production use.
pdf2md
Converts PDF files to Markdown using the Gemini API.
Installation
From PyPI (Recommended)
pip install pdf2md
For pre-release versions:
pip install --pre pdf2md
From Source
git clone https://github.com/marcbadiam/pdf2md.git
cd pdf2md
pip install -e .
Project Files
pdf2md.py: Main conversion script.setup.sh: Setup helper for API key configuration and command installation.
Dependencies
System dependencies:
- Python 3.8 or later.
- Bash.
- Coreutils (
installcommand). - Internet access to call the Gemini API.
Installation
- Enter the project directory.
- Run the setup script:
bash setup.sh
The setup.sh script:
- Prompts for the API key in the terminal.
- Stores
MY_GEMINI_API_KEYin the active shell rc file. - Installs the
pdf2mdcommand in/usr/local/binif writable. - Falls back to
~/.local/binwhen/usr/local/binis not writable.
If installation uses ~/.local/bin and it is not in PATH, add this line to your rc file:
export PATH="$HOME/.local/bin:$PATH"
Usage
Direct script usage:
python3 pdf2md.py <input.pdf> [output.md]
Installed command usage:
pdf2md <input.pdf> [output.md]
Behavior:
input.pdf: Input PDF file path.output.md: Optional output file path. If omitted, the script uses the input filename with.md.
Examples
python3 pdf2md.py document.pdf
python3 pdf2md.py document.pdf output.md
pdf2md document.pdf
pdf2md document.pdf output.md
Configuration
Set your Gemini API key as an environment variable:
export MY_GEMINI_API_KEY="your_api_key_here"
For permanent configuration, add it to your shell rc file (~/.bashrc, ~/.zshrc, etc.):
echo 'export MY_GEMINI_API_KEY="your_api_key_here"' >> ~/.bashrc
source ~/.bashrc
Notes
MY_GEMINI_API_KEYmust be set for API requests to work.- Open a new terminal or reload your shell session after rc file changes.
Features
- 📄 PDF to Markdown conversion using Google Gemini API
- 🔍 Advanced OCR with support for complex layouts
- 📊 Table detection and formatting
- 🔢 Mathematical formulas rendered in LaTeX
- 💻 Code block detection with syntax highlighting
- 🖼️ Image handling with transcription and descriptions
- 🌍 Multi-language support preserves original document language
Requirements
- Python 3.8 or higher
- Google Gemini API key
- Internet connection
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
Metadata
Release files for pdf-to-md 0.1.0b1
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 | |
|---|---|---|---|---|
| pdf_to_md-0.1.0b1.tar.gz | 5.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pdf_to_md-0.1.0b1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / pdf_to_md-0.1.0b1.tar.gz
| Download URL | pdf_to_md-0.1.0b1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ca6849019c05c79aaa8ecbaa2d25029ce60af71643959e3629dea4216afaa54
|
|
BLAKE2b-256 checksum How to use checksums |
607edbcae1296ad8f9c8caf6d1b5a3e75e6ed269913890fdf94af975197f218e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.
Transparency logRelease files / pdf_to_md-0.1.0b1-py3-none-any.whl
| Download URL | pdf_to_md-0.1.0b1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10f909350e4d339a04507190591c2cc6d21dec920ad472c5f96837398315d886
|
|
BLAKE2b-256 checksum How to use checksums |
36b758fb9c4cb8730a447eb714ab4b8317790f3806a5cff20041d128d9b66d0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.
Transparency logSecurity for pdf-to-md 0.1.0b1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pdf_to_md-0.1.0b1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.
Transparency logA 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.