Skip to main content

CLI tool to convert PDFs to markdown using Mistral OCR

Project description

Mistral OCR PDF

CLI tool to convert PDFs to markdown using Mistral OCR.

Installation

pip install mistral-ocr-pdf
# or with uv
uv pip install mistral-ocr-pdf

Usage

Convert a PDF to markdown:

mistral-ocr-pdf input.pdf
# Output will be saved as input.md

Specify output file:

mistral-ocr-pdf -o output.md input.pdf

Save raw OCR response JSON for debugging:

mistral-ocr-pdf --output-json response.json input.pdf

API Key Configuration

The Mistral API key can be configured in three ways:

  1. Environment variable:

    export MISTRAL_API_KEY="sk-xxxx"
    mistral-ocr-pdf input.pdf
    
  2. Config file:

    mistral-ocr-pdf -sk api_key -sv "sk-xxxx"
    # This saves the key to ~/.config/mistral_ocr_pdf/config.json
    
  3. Direct config file editing: Create or edit ~/.config/mistral_ocr_pdf/config.json with:

    {
      "api_key": "sk-xxxx"
    }
    

Run with uv

You can also run the tool directly with uvx:

uvx mistral-ocr-pdf input.pdf

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_ocr_pdf-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

mistral_ocr_pdf-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file mistral_ocr_pdf-0.1.0.tar.gz.

File metadata

  • Download URL: mistral_ocr_pdf-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for mistral_ocr_pdf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c233c5e594d31dfeca04191d2f41ed94e48b9c069c59cf116d0d622d7ada47e
MD5 ce3331d293f72fad37a0005c6a63880d
BLAKE2b-256 4a1f5ce85c79acfec35ef2a500f5cd3aba105bb25f1da971443680bba1ebdf76

See more details on using hashes here.

File details

Details for the file mistral_ocr_pdf-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mistral_ocr_pdf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9caf329be2b6170b75c52760b33b7ad2fb40bee701798f3319c05fb59b7ba5b9
MD5 f6f3c7f457d67b40a0a611263d74b91a
BLAKE2b-256 d1ec51b06fa23c35829a007f89d84da992edbe5055074cd685ebb561421d284f

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