Skip to main content

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

As a CLI Tool (Recommended)

With full OCR support for scanned PDFs:

uv tool install "mmpdfkit[ocr]"

Without OCR (faster, for digital PDFs only):

uv tool install mmpdfkit

Then use the mmpdfkit command:

mmpdfkit example.pdf              # Convert to Markdown
mmpdfkit inspect example.pdf      # Extract metadata as JSON

As a Python Library

Standard install:

pip install mmpdfkit

With OCR support:

pip install "mmpdfkit[ocr]"

For Development

git clone https://github.com/kaungsithu/mmpdfkit.git
cd mmpdfkit
pip install -e ".[dev,ocr]"
pre-commit install

Usage

CLI Examples

After installing with uv tool install "mmpdfkit[ocr]":

# 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

# Save to custom output directory
mmpdfkit example.pdf --output-dir ./out/

# Disable OCR for faster processing (digital PDFs)
mmpdfkit example.pdf --no-ocr

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

Use uvx to run mmpdfkit without installing it globally:

# Without OCR (fastest)
uvx mmpdfkit example.pdf

# With OCR for scanned PDFs
uvx "mmpdfkit[ocr]" example.pdf

Tip: For repeated use, uv tool install is faster than uvx since it caches the installation.

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

OCR Support

When installed with [ocr] extra, scanned PDFs are automatically processed with optical character recognition.

Disable OCR by default (optional configuration at ~/.mmpdfkit/config.yaml):

enable_ocr: false

Or use --no-ocr flag for individual conversions:

mmpdfkit scanned.pdf --no-ocr

Running from Source (Development)

After cloning and installing with pip install -e ".[dev,ocr]":

# CLI (same as installed version)
mmpdfkit example.pdf
mmpdfkit inspect 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.

Metadata

Release files for mmpdfkit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mmpdfkit 0.2.0
File Size Uploaded
mmpdfkit-0.2.0.tar.gz 118.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mmpdfkit 0.2.0
File Interpreter ABI Platform
mmpdfkit-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 143.4 kB

Release files / mmpdfkit-0.2.0.tar.gz

Download URL mmpdfkit-0.2.0.tar.gz
Size 118.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef4dbc41ee48d3565a0f1585db9d4f077bdbf250117f0828f74b0d68dbf4673c
BLAKE2b-256 checksum
How to use checksums
33d6b03c0825f37d86505c3378f783fca00d06666a9f090f4bd0013e588e49f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / mmpdfkit-0.2.0-py3-none-any.whl

Download URL mmpdfkit-0.2.0-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ddcc5245b67f70db441949371d3e8e3c0f7e80a2ea73eb379a5b02440df84fe
BLAKE2b-256 checksum
How to use checksums
f2cf1854dc8fbdd64cde89840d1e3c8bb431deea0a223cac0a44a40a1706fd36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page