Broken Unicode and missing micro-spaces

  1. Some PDFs render correctly, but extracted text has broken Unicode because of embedded subset TrueType fonts and missing or invalid ToUnicode / font encoding.
  2. We also need a reliable way to detect micro-spaces or invisible whitespace fragments and get their geometry / visibility state.

The important part is that we need an API-level answer from Aspose. We are not looking for word replacements or cleanup rules for one document.

If they ask for samples, we can provide the PDFs and extraction output.

Thanks.

Text letter:

Subject: Aspose.PDF for Java 26.5: Unicode extraction and invisible whitespace detection in PDFs

Hello Aspose Support,

We use Aspose.PDF for Java 26.5 (aspose-pdf-26.5.jar) in a Java service that extracts PDF text and text geometry.

We are seeing two PDF text extraction issues. I am grouping them in one request because both affect the same extraction flow, but they are separate cases.

Issue 1: incorrect Unicode from embedded subset TrueType fonts

We have a PDF that renders correctly in viewers, but Aspose extracts corrupted text in some places. The affected text appears to use embedded subset TrueType fonts. From what we can see, the PDF likely has missing or invalid ToUnicode / custom font encoding data.

Examples:

  • Wstęp is extracted as Wstp
  • Kolędy is sometimes extracted as Koldy
  • Zakończenie is sometimes extracted as ZakoMczenie
  • Other fragments contain values such as wstampujemyA, pojechaˇ, V(W, or substitutions like 9, 2, A, H

Minimal reproduction:

com.aspose.pdf.Document document = new com.aspose.pdf.Document(inputPdfPath);
try {
com.aspose.pdf.TextAbsorber absorber = new com.aspose.pdf.TextAbsorber();
document.getPages().accept(absorber);
System.out.println(absorber.getText());
} finally {
document.close();
}

What we need to know:

  • Is this expected behavior when ToUnicode is missing or invalid?
  • Can Aspose.PDF for Java recover Unicode from the embedded font program, glyph names, or font encoding?
  • Is there any Java API to inspect the mapping Aspose uses, for example PDF character code → glyph id → Unicode?
  • Should we attach our PDF as a new issue, or can this be linked to an existing ticket?

Closest related threads:

Issue 2: micro-spaces / invisible whitespace fragments

We also need to detect micro-spaces or invisible spacing markers in PDFs. In Aspose terms, this seems close to zero-width, hidden, invisible, or not-rendered whitespace/text fragments.

For these fragments we need to:

  • detect them reliably;
  • get their page position / geometry;
  • distinguish them from normal visible text;
  • know whether they are hidden, transparent, zero-width, not rendered, or visible.

TextState.Invisible does not seem to cover all cases, based on the public threads below. Please confirm whether this property is expected to cover all hidden/invisible text cases, or only specific rendering modes.

Closest related threads:

For both issues, we are not looking for document-specific word replacements or cleanup rules. We need an API-level approach at the font/text-fragment level.

We can provide sample PDFs and extraction output if needed. Please let us know what diagnostic data would be useful.

Thank you.

@plagiatpl
Hi
We would be grateful for examples of such files so we could investigate this issue

UPH-WH-FP-SL-125266_Unicode.pdf (399,9 КБ)

manipulation_microspaces.pdf (657,8 КБ)

1949_922741_2026-05-27_09-37_57_536_Dokument_testowy___kowersja2.pdf (2,0 МБ)