Troubleshooting

When a PDF comes out wrong, find out why in three steps.

No text at all

If the summary says 0 Khmer characters and notes that the PDF is scanned, the file is pictures of text. khpdf can't read it; it needs OCR.

Look at the fonts

Terminal
khpdf adb-book.pdf --pages 4 --inspect-fonts
Output
Page 4 (595x842, needs_ocr=false):
  - F1 | BaseFont=FCGKGL+HelveticaNeue-Roman | Subtype=Type1 | Enc=WinAnsiEncoding | ToUnicode=false | Embedded=true | Legacy=-
  - TT6 | BaseFont=FCFOAG+LimonS1 | Subtype=TrueType | Enc=WinAnsiEncoding | ToUnicode=false | Embedded=true | Legacy=limon
  ! warning: 13 overprinted duplicate text fragment(s) (shadow/fake-bold) dropped.

Look at the raw fragments

For a close look, print every fragment khpdf extracted, with its position, size, font and how each letter was recovered:

Terminal
KHPDF_DEBUG_SPANS=1 khpdf report.pdf --pages 3 > /dev/null

--no-normalize shows the text before Khmer reordering, which tells you whether a problem is in the letters themselves or in their order.

Report it

Open an issue on GitHub with a link to the PDF (or one page of it), the page number, what you expected and what you got. Every fix so far started from a real document like yours.