Skip to main content

Convert Burmese PDFs to clean, usable Markdown and text for AI applications, data analysis, and vectorization

Project description

mmpdfkit

Convert Burmese PDFs to clean, usable Markdown and text for AI applications, data analysis, and vectorization.

What is mmpdfkit?

mmpdfkit solves a critical problem for anyone working with Burmese/Myanmar text: extracting usable content from PDFs with mixed encodings, legacy fonts, and scanned documents.

Burmese PDFs often contain text in multiple non-Unicode encodings (Win Myanmar, Zawgyi) or are entirely scanned. This makes them unsuitable for AI model input, vectorization, or modern text processing pipelines. mmpdfkit automatically:

  • Detects and converts legacy Myanmar encodings (Win Myanmar, Zawgyi) to proper Unicode
  • Extracts text with layout preservation via Markdown formatting
  • OCR scans for documents that are image-based
  • Preserves structure (headings, paragraphs, spacing) during conversion

Use Cases

  • AI/LLM contexts — Clean Burmese text for prompt context or fine-tuning
  • Vectorization — Prepare PDFs for embedding and vector databases
  • Text analysis — Linguistic research on Burmese corpora
  • Content migration — Convert legacy Burmese digital archives to modern formats

Install

# Standard install (as library + CLI)
pip install -e ".[dev]"

# With OCR support
pip install -e ".[dev,ocr]"

# Set up pre-commit hooks (runs ruff linting and formatting on commit)
pre-commit install

Usage

Quick Start

# Convert PDF to Markdown (output next to input)
mmpdfkit example.pdf          # → example.md

# Convert all PDFs in a directory
mmpdfkit samples/             # → all .md files in same dir

# Skip OCR for scanned documents
mmpdfkit example.pdf --no-ocr

# Custom output directory
mmpdfkit example.pdf --output-dir ./out/

Inspect PDF Metadata

# Extract font/text metadata as JSON
mmpdfkit inspect example.pdf    # → example_inspection.json

# Inspect all PDFs in directory
mmpdfkit inspect samples/

One-Shot Usage (No Install)

# Run directly with uv (fastest)
uvx mmpdfkit example.pdf

Library Usage

from mmpdfkit import pdf_to_markdown, inspect_pdf

# Convert PDF to markdown string
md = pdf_to_markdown("example.pdf")

# Inspect PDF metadata
inspection = inspect_pdf("example.pdf")

Advanced: OCR Configuration

Scanned PDFs are automatically processed with OCR (when paddleocr is installed).

Optional configuration at ~/.mmpdfkit/config.yaml:

enable_ocr: false  # Set to false to disable OCR by default

Developer Usage

# Run as module (for development/debugging)
python -m mmpdfkit.markdown samples/example.pdf
python -m mmpdfkit.pdf_inspector samples/example.pdf

Testing

Run the test suite:

pytest tests/ -v

Test fixture: test-pdfs/test.pdf is a minimal 3-page fixture combining sample pages from various Myanmar PDFs (digital typeset + scanned pages) for testing both text extraction and OCR pipelines.

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

mmpdfkit-0.1.0.tar.gz (113.4 kB view details)

Uploaded Source

Built Distribution

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

mmpdfkit-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.0.tar.gz
  • Upload date:
  • Size: 113.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mmpdfkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 426ecc27345869a25127820920a8cf91808e475c39af089e89d7e9d7ea7d8ec4
MD5 cdb3fe267f72e07d020631a3bf3a0e18
BLAKE2b-256 833d0fa7bfdb93f2f0643cfdf10b6862b3b388e32fed166e692205c562f51f32

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mmpdfkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 054d0b8d7a2a674e964ca3a56a9ea68485cd33476c11a333ec36131a9ca87e42
MD5 f0e7b5204801bc6369aa40f96df75539
BLAKE2b-256 ffcb7bafd615915461439eb8e8ee49d4fe27b08a867dc9c5541cea11769017b5

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