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

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 --with paddleocr mmpdfkit 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.

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.2.tar.gz (113.7 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.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.2.tar.gz
  • Upload date:
  • Size: 113.7 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.2.tar.gz
Algorithm Hash digest
SHA256 5006896892eab75773ff353fbb2f05f37fabc80eeb877a4f0afb9004f8b1de5d
MD5 70d6de9745da9a315d7b3eeb4f489954
BLAKE2b-256 9f662e5c3acc650bbaef9520c382c138739556ef0507e4ada3f09bb0e91de178

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmpdfkit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f20777f83e2a4461655a2c257715b6b61b78a21db7e32dbb2c3a17edce5215ae
MD5 f041b7d05423e569502bdf56ffef99bb
BLAKE2b-256 8602c76636cf0d8cc534b466b71d5475fa4d1960f6f670e3035f8a3ee12432e1

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