Skip to main content

KurdPDF: correct Central Kurdish text from any PDF

License: GPL-3.0-or-later PyPI CI Docs Python 3.14+ Runs offline

KurdPDF

Get correct Central Kurdish (Sorani, ckb) text out of PDFs. · دەقی کوردی بە دروستی لە PDF دەربهێنە.

Copying text from many Kurdish PDFs gives Latin gibberish (†òÔð ØíІñ instead of دەقی کوردی), reversed or disconnected letters, or empty boxes. The cause is the fonts: legacy Latin-mapped fonts (Ali-K, Ali-A and others), presentation-form text, broken ToUnicode maps, opaque Type 3 fonts, and scanned pages. KurdPDF inspects every font in the PDF, identifies glyphs by their outlines with HarfBuzz, and picks the right way to recover each one. Everything runs on your computer.

Copied from the PDF: Latin gibberish. Read by KurdPDF: دەقی کوردی دروست

Features

  • Every kind of broken Kurdish PDF: legacy fonts (Ali-K, Ali-A, Zanest, and the Halabja family: Halabja, Mewlewi, Nali, Kerkuk, Diyarbekir, Nesrin), wrong or missing ToUnicode maps, private-use and glyph-order maps, presentation forms in visual order, separate dot and mark glyphs, Windows printer-driver fonts, and scanned pages (OCR with Tesseract). Fonts are identified by glyph outlines, never by name.
  • Checked, not guessed: each page is shaped again with HarfBuzz and compared with the glyphs drawn; look-alike letters (ک/ك, ی/ي, ە/ه) are settled with a Sorani word list you import; glyphs nothing can read are reported, never invented.
  • Nine formats: TXT, Markdown, DOCX (Word), ODT (LibreOffice), RTF, HTML, LaTeX (polyglossia, Sorani), EPUB and JSON (with a JSON Schema). Right-to-left paragraphs, Sahel for Kurdish and Manrope for Latin text by default (--font picks another).
  • Page structure: paragraphs, headings, lists and ruled tables kept; page numbers and running heads left out on request; two-column and two-page spreads read in order.
  • Faithful layers: the raw and resolved text stay as the PDF draws it; a separate orthography layer (zimankit's Sorani rules) normalizes only Kurdish lines, and every rule can be turned off.
  • Page tools: kurdpdf pages shows, extracts, splits, merges, turns, deletes and renders pages, and can convert what it cuts.
  • A local web page (kurdpdf web): a PDF page editor, a reader with page images beside the text and synced scrolling, fonts you choose (kept in your browser), and Save as… in every format. Installable as an app.
  • Batch conversion of files, folders and globs with progress; a failing file never stops the others.
  • For AI coding agents: kurdpdf skill install adds a skill that teaches Claude Code and similar agents to convert and diagnose Kurdish PDFs.

Install

With uv (Python 3.14+):

uv tool install kurdpdf          # the kurdpdf command, in its own environment
uvx kurdpdf book.pdf             # or run it once without installing
uv add kurdpdf                   # as a library in a uv project (after uv init)

pipx install kurdpdf works too. From source: uv sync, then uv run kurdpdf --help. See docs/install.md for plain virtual environments, the fonts for exported files, and OCR (Tesseract 5 with a Central Kurdish model).

Use

kurdpdf atlas build --font ~/fonts/kurdish   # once: reference fonts for glyph recovery
kurdpdf lexicon import words.tsv         # optional: a Sorani word list for look-alike letters
kurdpdf inspect book.pdf                 # which fonts, which classes, which pages are scanned
kurdpdf book.pdf                         # writes book.txt next to the PDF
kurdpdf book.pdf --format docx,odt,md --out out/   # Word, LibreOffice and Markdown
kurdpdf convert books/ --recursive --format all --out out/   # every format
kurdpdf pages extract book.pdf --pages 5-20 --format docx    # cut pages and convert them
kurdpdf pages merge cover.pdf book.pdf:3-200 -o clean.pdf
kurdpdf web                              # the page editor and reader in your browser
kurdpdf help pages split                 # help with examples for any command
kurdpdf manual                           # full manual
from kurdpdf import KurdPDF

doc = KurdPDF("book.pdf").extract()
for font in doc.fonts:
    print(font.name, font.font_class)
print(doc.pages[0].best_text())

Font classes

Class Meaning
C1 Unicode text, usable as is
C2 Broken map (U+FFFD or private-use characters)
C3 Presentation forms, often in visual order
C4 Legacy Latin-mapped Kurdish font
C5 Opaque font program (MSTT31, Type 3)
C6 Font not embedded or not loadable

Scanned pages are reported as page method no-text and read by OCR when Tesseract is installed. Details in docs/fonts-and-atlas.md.

Known limits

  • Without an atlas built from fonts like the ones in your PDFs, broken text layers (C2) can only be partly recovered.
  • Legacy families other than Ali-K, Ali-A, Zanest and the Halabja family (Halabja, Mewlewi, Nali, Kerkuk, Diyarbekir, Nesrin) are not read yet.
  • OCR makes about 7 character errors in 100 on prose and does badly on classical poetry; see docs/ocr.md.
  • Tables without ruling lines are read as lines, row by row; tables printed sideways are not recognised.

Roadmap

  • Tables for more legacy families.
  • A desktop app around the web page.

Documentation

https://kanilabs.github.io/kurdpdf/

Install · Usage · Brand · Launch kit · Fonts and atlas · OCR · Architecture · Kurdish support checks · Development · Changelog · Contributing. The full manual: kurdpdf manual.

Development

uv run pytest
uv run ruff check .
uv run ruff format --check .

Test PDFs are generated at test time. Real sample PDFs and fonts are kept locally and never committed. See AGENTS.md.

  • zimankit: Kurdish normalization, orthography and word list, used by KurdPDF's text layer.

License

GPL-3.0-or-later; see LICENSE. PyMuPDF is AGPL-3.0: running KurdPDF as a network service also means meeting the AGPL terms for PyMuPDF.

Metadata

Release files for kurdpdf 0.1.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 kurdpdf 0.1.0
File Size Uploaded Provenance Actions
kurdpdf-0.1.0.tar.gz 552.3 kB With provenance Details for kurdpdf-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / kurdpdf-0.1.0.tar.gz

Download URL kurdpdf-0.1.0.tar.gz
Size 552.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f46b00610ae328541a9fcb2c33acbde9df637417b7e9f804d08931dc24477d86
BLAKE2b-256 checksum
How to use checksums
947a44619c3d6ff37f7415516098f9089378ae2e51c4be132ea1c9134e925bcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / kurdpdf-0.1.0-py3-none-any.whl

Download URL kurdpdf-0.1.0-py3-none-any.whl
Size 580.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1eabd29c51f6345f6dc6e519c11198198e8c79fb86870ff955fe23004059d51
BLAKE2b-256 checksum
How to use checksums
0dbe5099342d480d0316bd8fb70b9938400f3989cfea92075dfc813901b60056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for kurdpdf 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kurdpdf-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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