Tools,

Hindi PDF to Word, tested

185 of 185

short i signs kept in each PDF: the script

Hindi PDF to text in one call

Whole words right, 3 typed PDFs

Way Chromium Libre­Office reportlab
LibreOffice Writer 50.4% 5.2% 50.5%
pdf2docx 91.0% 98.7% 49.8%
pdftotext, then pandoc 97.5% 97.3% 53.0%
Tesseract hin, then pandoc 99.0% 99.1% 99.4%
Our Actor, then pandoc 98.8% 98.9% 99.0%
The script on this page 97.5% 97.3% 99.4%

Why free converters break Hindi

The script: text first, OCR if broken

It copies each page's text, and sends a broken page to Tesseract: private codes, a word that starts with a vowel sign, or 200+ Hindi letters with no ि.

python3 hindi_pdf_to_word.py in.pdf out.docx
hindi_pdf_to_word.py, the whole script
"""Hindi PDF to Word: an editable .docx. The script of brasspage.com/hindi-pdf-to-word/

Needs on your PATH: Poppler (pdftotext, pdftoppm), Tesseract with the hin model, and pandoc. Python 3, stdlib only.
python3 hindi_pdf_to_word.py in.pdf out.docx

Each page: the PDF's own text (pdftotext). A page whose own text is broken is read by Tesseract (300 dpi, hin)
instead. Broken: no text (a scan), Private Use Area characters (half letters a font kept to itself), NUL characters,
a word that starts with a vowel sign or halant, or 200 or more Hindi letters with no short i sign (ि). Blank lines
split paragraphs. pandoc writes the .docx, and set_hindi() marks it Hindi for complex script too (hi-IN, not
pandoc's ar-SA). Each page's choice goes to stderr.
"""

import html
import re
import subprocess
import sys
import unicodedata
import zipfile

LETTER = "ऀ-ॣॱ-ॿ"  # Devanagari letters and signs
SIGN_FIRST = re.compile(f"(?<![{LETTER}])[ऀ-ःऺ-ॏ]")


def broken(text):
    """Why a page's own text is broken, or None if it looks right."""
    t = unicodedata.normalize("NFC", text).translate({0x200C: None, 0x200D: None})
    if len(re.findall(r"\w", t)) < 20:
        return "no text"
    if re.search("[\ue000-\uf8ff]", t):
        return "Private Use Area characters"
    if "\x00" in t:
        return "NUL characters"
    if SIGN_FIRST.search(t):
        return "a word starts with a vowel sign or halant"
    if len(re.findall(f"[{LETTER}]", t)) >= 200 and "ि" not in t:
        return "no short i sign"
    return None


def ocr(pdf, n):
    page = ["pdftoppm", "-r", "300", "-gray", "-png", "-f", str(n), "-l", str(n), pdf]
    png = subprocess.run(page, capture_output=True, check=True).stdout
    # hin's own config never writes the digit 1 (tessedit_char_blacklist 1): 2012 came out 2042. Clear it.
    cmd = ["tesseract", "-", "-", "-l", "hin", "--dpi", "300", "-c", "tessedit_char_blacklist="]
    return subprocess.run(cmd, input=png, capture_output=True, check=True).stdout.decode()


def paragraphs(text):
    return [" ".join(b.split()) for b in re.split(r"\n\s*\n", text) if b.strip()]


def pdf_to_docx(pdf, docx):
    out = subprocess.run(["pdftotext", "-enc", "UTF-8", pdf, "-"], capture_output=True, check=True).stdout.decode()
    paras = []
    for n, text in enumerate(out.split("\f")[:-1], 1):  # pdftotext ends every page with a form feed
        why = broken(text)
        print(f"page {n}: " + (f"OCR ({why})" if why else "text layer"), file=sys.stderr)
        paras += paragraphs(ocr(pdf, n) if why else text)  # ponytail: a paragraph across a page break stays two
    body = "".join(f"<p>{html.escape(p)}</p>\n" for p in paras)
    subprocess.run(["pandoc", "-f", "html", "-o", docx, "-M", "lang=hi"], input=body.encode(), check=True)
    set_hindi(docx)


def set_hindi(docx):
    """pandoc's styles keep Arabic as the complex-script language (w:bidi="ar-SA"). Make it Hindi."""
    with zipfile.ZipFile(docx) as z:
        parts = [(info, z.read(info)) for info in z.infolist()]
    with zipfile.ZipFile(docx, "w") as z:
        for info, data in parts:
            if info.filename == "word/styles.xml":
                data = data.replace(b'w:bidi="ar-SA"', b'w:bidi="hi-IN"')
            z.writestr(info, data)


if __name__ == "__main__":
    pdf_to_docx(sys.argv[1], sys.argv[2])

Kruti Dev to Unicode, offline

Kruti Dev is an old Hindi font that draws Hindi from Latin codes. मेरा नाम नेहल है। is stored as esjk uke usgy gSA.

python3 -m venv kd
kd/bin/pip install krutidev-unicode==1.0.1
kd/bin/krutidev-unicode to-unicode codes.txt > unicode.txt

Tested on macOS. On Windows use kd\Scripts\pip and kd\Scripts\krutidev-unicode (not tested).

Converter Words back, of 925
krutidev-unicode (PyPI), @kovapdf (npm) 925
legacy-fonts-to-unicode, @bharattype 924
kruti-unicode-converter 923
How I tested Kruti Dev
  • The same 12 passages, written as Kruti Dev codes by legacy-fonts-to-unicode 1.0.0 and by krutidev-unicode 1.0.1 (npm and PyPI), then read back by 5 converters. The table shows each converter's lowest score over those 3 code sets.
  • krutidev-unicode on PyPI is a port of @kovapdf/krutidev-unicode on npm, with the same tables: one tool in two languages.
  • kruti-unicode-converter 1.0.1 writes codes that lose the nukta (क़ as क) and leave / ' : as they are, so every converter got 895 of 925 words from them. Its README command failed; its library worked.
  • All 4 writers gave esjk uke usgy gSA for the sample, and all 5 converters read it back right.
  • Kruti Dev has no straight apostrophe, so ' came back curly. No letter was lost.
  • kru2uni (GPL-3.0) did not run: it is Python 2, and this Mac has Python 3.

A Kruti Dev PDF often copies as codes

Convert the codes as above. With no Kruti Dev font here, my look-alike test PDF drew them in a Latin font.

pdftotext gave back its exact codes on all 12 pages, and krutidev-unicode made 925 of 925 words.

On that PDF, our Actor kept the codes on all 12 pages. On a real Kruti Dev PDF it may OCR some pages into Hindi: not tested. The script always keeps the codes.

No OCR install: our Actor, then pandoc

Our Apify Actor, PDF to Markdown OCR, takes language hin. It read all 36 test pages by OCR: 98.8% to 99.0% of words right.

It unblocks the digit 1: all 24 numbers right in each file.

The API call, then pandoc
curl -s -X POST "https://api.apify.com/v2/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"documentUrls": ["https://example.com/your-file.pdf"], "language": "hin"}' \
  | jq -r '.[].markdown' > out.md
pandoc out.md -o out.docx -M lang=hi

What I tested, and what I did not

How I tested
  • Text: 12 passages from Hindi Wikipedia (CC BY-SA 4.0), one a page: 925 words, 185 short i signs and 24 numbers.
  • PDFs in Noto Sans Devanagari: Chromium 153 print to PDF, LibreOffice 26.8.1.1 export, and reportlab 5.1.2 with shaping on.
  • Ways: LibreOffice Writer (soffice --infilter=writer_pdf_import), pdf2docx 0.5.13 with PyMuPDF 2.2, pdftotext from Poppler 26.03.0, Tesseract 5.5.4 with tessdata_fast hin 4.1.0 at 300 dpi, pandoc 3.13 -M lang=hi.
  • On 6 test PDFs (Noto Sans and Serif Devanagari) it sent 0 of 48 good pages to OCR, and 24 of 24 reportlab pages. Private codes alone caught every reportlab page.
  • Words right: truth words found whole in the .docx text, each word counted as often as it appears.
  • Our Actor: its page code at commit 0d3b702f, language hin, Markdown out, then pandoc.
  • The Kruti Dev test PDF: the 12 passages as codes, drawn by reportlab in DejaVu Sans, so it copies like a Kruti Dev PDF but does not look like one.
Sources
  • Kruti Dev on Wikipedia: a non-Unicode font that puts Devanagari glyphs on ASCII codes.
  • pdf2docx is MIT. It needs PyMuPDF, which is AGPL-3.0 or a paid license.
  • krutidev-unicode 1.0.1 on PyPI and @kovapdf/krutidev-unicode on npm, both MIT.
  • tessdata_fast hin for Tesseract (Apache-2.0).
  • Font: Noto Sans Devanagari, OFL.
  • Scripts and results stay in our private repo, in research/bench/hindi-pdf-to-word-2026-11-27/.
  • We make the Apify Actor, not these tools.

Questions people ask

How do I convert a Hindi PDF to Word for free?

Copy the PDF's own text where it is good, OCR the pages where it is broken, then let pandoc write the .docx. The free script on this page did that on 3 typed PDFs: 97.3% to 99.4% of words right, and every short i sign.

Why are the matras wrong after Hindi PDF to Word?

The converter rebuilt the text from the drawn shapes, or copied a broken text layer. LibreOffice Writer lost every short i sign from a Chromium PDF. A reportlab PDF stored its half letters as private codes. OCR of the page image fixed both.

How do I convert Kruti Dev to Unicode?

Save the Kruti Dev text as a UTF-8 text file and run krutidev-unicode to-unicode on it. It runs offline and gave back 925 of 925 test words. The other free converters I tested got 923 or 924.

Can I convert Unicode Hindi to Kruti Dev?

Yes: krutidev-unicode to-kruti does it. Avoid the writer of kruti-unicode-converter 1.0.1: it lost the nukta of क़, ज़ and फ़ and left slash, apostrophe and colon as they are, so 30 of 925 words came back wrong.