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
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 installis faster thanuvxsince 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mmpdfkit-0.2.0.tar.gz.
File metadata
- Download URL: mmpdfkit-0.2.0.tar.gz
- Upload date:
- Size: 118.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef4dbc41ee48d3565a0f1585db9d4f077bdbf250117f0828f74b0d68dbf4673c
|
|
| MD5 |
25e4ac89e3ac696706ee88a8d3dbc449
|
|
| BLAKE2b-256 |
33d6b03c0825f37d86505c3378f783fca00d06666a9f090f4bd0013e588e49f3
|
File details
Details for the file mmpdfkit-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mmpdfkit-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ddcc5245b67f70db441949371d3e8e3c0f7e80a2ea73eb379a5b02440df84fe
|
|
| MD5 |
0ebc4e54f1d7c6c87597d7111afdf0f6
|
|
| BLAKE2b-256 |
f2cf1854dc8fbdd64cde89840d1e3c8bb431deea0a223cac0a44a40a1706fd36
|