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, no OCR)
uvx mmpdfkit example.pdf

# With OCR support for scanned PDFs
uvx --with paddleocr 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.1.tar.gz (113.5 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.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.1.tar.gz
  • Upload date:
  • Size: 113.5 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.1.tar.gz
Algorithm Hash digest
SHA256 b413a6effafb8d96e3bf75e7ec59abccc818259c6f69a04746e13b59e58946a3
MD5 a3764357e7941b1a1b27a376b1f5dff5
BLAKE2b-256 16d006ae5068c1cfa56fa3db70db164dc439624a2feaca37b6a787ded8a284f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdeeb4a3efb6230b89d787d4481592ae38c6a8ff82ab989788cec8e0cff03b2f
MD5 2ca40d92b234a14a1c0075dd234c3ab3
BLAKE2b-256 e21d952d1611c028005e770b6db9a408ceb2c2aaaa572d15379b8d9c9633cf1c

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