Skip to main content

This project contains a command line tool to convert PDF to markdown. It uses image conversion and a LLM to convert the images to markdown.

Project description

PDF to Markdown

This project contains a command line tool to convert PDF 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"
# conda remove -n pdf_to_markdown --all
conda create -n pdf_to_markdown python=3.13
conda activate pdf_to_markdown
pip install poetry
# Windows
pip install cmake
conda install poppler poppler-qt
# End Windows
# 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
poetry install

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 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_to_markdown_llm-0.1.10.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_to_markdown_llm-0.1.10-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file pdf_to_markdown_llm-0.1.10.tar.gz.

File metadata

  • Download URL: pdf_to_markdown_llm-0.1.10.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.1 Windows/11

File hashes

Hashes for pdf_to_markdown_llm-0.1.10.tar.gz
Algorithm Hash digest
SHA256 8f274f054359f7e07c97c3c1676b2211bf07574a8b04d037feed13d7e6edd9b4
MD5 c62e01f0f371f8e929b27b4140baf30a
BLAKE2b-256 59a9c359d67b3bce2c707698799292dddd0ec2aa988302d1d9f1970005f68d4c

See more details on using hashes here.

File details

Details for the file pdf_to_markdown_llm-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for pdf_to_markdown_llm-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 db411dc7ae1e0e6c21d8b0a5a3da80f0502e66bb83edd2181ac1aa8bff603a27
MD5 0f274ab271ef029ade101a8bc6e5ef45
BLAKE2b-256 5b4c7a065deb717905304a87d67d5e38977096219ea2cc2c46e37e0493a89918

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page