Skip to main content

A CLI tool to convert PDF files to Markdown using the Mistral AI OCR API.

Project description

Mistral PDF to Markdown

PyPI version uv

CLI tool to convert PDF and EPUB files to Markdown with the Mistral OCR API. Embedded images are saved next to the generated Markdown file.

The converter calls mistral-ocr-latest.

Installation

Install the published CLI:

pip install mistral-pdf-to-markdown

For an isolated global command:

pipx install mistral-pdf-to-markdown

For local development:

git clone https://github.com/arcangelo7/mistral-pdf-to-markdown.git
cd mistral-pdf-to-markdown
uv sync --locked

EPUB conversion also requires pandoc: https://pandoc.org/installing.html

Usage

Set your Mistral API key:

export MISTRAL_API_KEY='your_api_key_here'

You can also use a .env file or pass --api-key.

pdf2md convert ./document.pdf
pdf2md convert ./document.epub -o ./output/document.md
pdf2md convert-dir ./documents -o ./markdown_output -w 4

Output images are written to <output_filename_stem>_images/ and linked from the Markdown file.

The repository includes example.md, generated from example.pdf.

License

ISC. See LICENSE.

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

mistral_pdf_to_markdown-1.2.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

mistral_pdf_to_markdown-1.2.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file mistral_pdf_to_markdown-1.2.1.tar.gz.

File metadata

  • Download URL: mistral_pdf_to_markdown-1.2.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mistral_pdf_to_markdown-1.2.1.tar.gz
Algorithm Hash digest
SHA256 fb1e18cb13469d8649a5c4dbacd599f178f6e4a8e5f24d2f6bc92d588a84b65c
MD5 1467f8ccd727bc2854290a1b839dd881
BLAKE2b-256 5708b14c51c20c595c1d9f600a964828c802416fd17c43bdaa5b65c88a9d9eb0

See more details on using hashes here.

File details

Details for the file mistral_pdf_to_markdown-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: mistral_pdf_to_markdown-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mistral_pdf_to_markdown-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 50fdd8f32866fb8734c0eabc29781b26eaf2bc2abcded964c47a731e935d598f
MD5 311049876df1867e664c656445484fae
BLAKE2b-256 89c5301d6a341f3724a0714bf56fad44a5ab0e4f15693da274d5fad187024cc9

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