Skip to content
English
  • There are no suggestions because the search field is empty.

IronOCR: How to Fix Garbled Text for Searchable PDFs in Non-Latin Scripts

Overview

When you OCR a document with IronOCR and save it as a searchable PDF, the recognized text can look correct on screen but turn into garbled characters when you copy or extract it. This happens when the font used by the PDF does not include glyphs for the script you recognized. It is common with non-Latin and complex scripts. This article shows you how to fix it by saving the PDF with a font that supports your script, using Gujarati as the example.

Version metadata

  • Minimum Version: 2026.3.3
  • Superseded-In Version: N/A

Prerequisites

  • IronOCR with the language pack for your script (this example uses Gujarati: OcrLanguage.GujaratiBest
  • A TrueType font that supports your target script (this example uses AnekGujarati, freely available from Google Fonts)
  • The full file path to that font

Steps

  1. Find a font that supports your target script, place it on the machine, and note its full path. For the Gujarati example:
    C:\Path\To\AnekGujarati-VariableFont_wdth,wght.ttf
  2. When saving the searchable PDF, pass the font path and the language name to SaveAsSearchablePdf():
    ocrResult.SaveAsSearchablePdf(       
    strOutputFile,       
    false,       
    @"C:\Path\To\AnekGujarati-VariableFont_wdth,wght.ttf",       
    "Gujarati");

     

  3. Replace the font path and the language name with the values for your own document. For a different language, point to a font that supports that script and pass the matching language name.
  4. Open the generated PDF and copy the text to confirm it now extracts correctly.

Notes and Limitations

  • This issue is not specific to Gujarati. Any non-Latin or complex script can show garbled copied text if the PDF font does not cover it. Examples include Devanagari (Hindi, Marathi), Arabic, Thai, and Chinese, Japanese, or Korean text.
  • For each language, supply a font that includes that script. The Noto font family from Google is a broad option, as it has per-script fonts such as Noto Sans Gujarati, Noto Sans Devanagari, and Noto Sans Arabic.
  • The font used by the searchable PDF must contain glyphs for the recognized script. If it does not, the recognized text has no matching characters to map to, which is why copied text comes out garbled even when OCR reads the page correctly.
  • A Latin-only font will not fix this. The font you supply has to support the script you recognized.
  • Match the language name you pass to SaveAsSearchablePdf() to the script you actually OCR'd.
  • The path must point to the exact font file. The AnekGujarati variable-font filename contains a comma (AnekGujarati-VariableFont_wdth,wght.ttf ), so copy it precisely.
  • If the copied text still appears garbled after this change, confirm the supplied font genuinely includes glyphs for your script.