Quick revision
The short answer
Characters go missing because the PDF uses fonts that have no glyphs for Chinese or Arabic, so we embed fonts that cover those scripts, such as the Noto families, and configure a fallback chain. Arabic also needs right-to-left ordering and shaping, which some PDF libraries lack, so we check our library and add its bidi and shaping support. Accessibility audits fail because the PDFs are untagged; we produce tagged PDFs that follow PDF/UA, with structure, alt text, reading order and a document language. Automated tests with names in many scripts and template standards keep it fixed.
What to remember
In this answer, we saw that characters go missing when the PDF's fonts have no glyphs for a script, so we embed fonts such as the Noto families and configure a fallback chain. Arabic and Hebrew also need bidi reordering and shaping, which some libraries lack, so we check ours and add support. Accessibility requires tagged PDFs following PDF/UA, with structure, alt text, reading order and language. Automated tests with names in many scripts, veraPDF validation and company-wide template standards keep both problems fixed across every generator.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Characters go missing because the PDF uses fonts that have no glyphs for Chinese or Arabic, so we embed fonts that cover those scripts, such as the Noto families, and configure a fallback chain. Arabic also needs right-to-left ordering and shaping, which some PDF libraries lack, so we check our library and add its bidi and shaping support. Accessibility audits fail because the PDFs are untagged; we produce tagged PDFs that follow PDF/UA, with structure, alt text, reading order and a document language. Automated tests with names in many scripts and template standards keep it fixed.
Why this question is asked
A statement that prints a customer's name as empty boxes is more than a cosmetic bug: it tells customers we cannot spell their name, and in some industries it can make a document legally questionable. Accessibility failures have the same weight, since many countries now require customer documents to work with screen readers. Interviewers ask this scenario because it combines text rendering internals with process: fixing one template is easy, fixing every generator in the company is the real task. In this answer, we will see why glyphs go missing, fix fonts and fallback, deal with right-to-left shaping, make PDFs accessible, and then add tests and standards so the problem does not come back.
1Why Characters Go Missing
A font is a collection of glyphs, the drawn shapes of characters. When a PDF library writes text, it looks up each character in the chosen font and embeds the glyph. If the font has no glyph for a character, there is nothing to draw. Depending on the library, we get an empty box, a blank space, a question mark, or an exception.
The usual cause is that templates use a Western font, or one of the 14 standard PDF fonts such as Helvetica, which only cover basic Latin characters. A name like Wang Xiaoming written in Chinese characters has no glyphs there. PDFBox makes this visible with an error such as a character being not available in the font Helvetica with WinAnsiEncoding; HTML renderers often fail silently, which is how the bug reached customers.
2Embedding Fonts and Configuring Fallback
The fix is to embed fonts that cover every script our customers use. The Noto families are designed for exactly this: Noto Sans for Latin, Greek and Cyrillic, Noto Sans SC, TC, JP and KR for Chinese, Japanese and Korean, Noto Naskh Arabic or Noto Sans Arabic, Noto Sans Devanagari, and so on. They are free under the SIL Open Font License, which allows embedding. CJK fonts are large, often more than 10 MB, but libraries embed only a subset of the glyphs actually used, so each PDF grows by a few kilobytes.
No single font covers everything well, so we configure a fallback chain: a list of fonts tried in order for each character. In HTML-to-PDF renderers such as OpenHTMLtoPDF, we register every font file with the builder and list them in the CSS font-family. With a low-level library like PDFBox, we have to choose the font per run of text ourselves, by checking which font has a glyph for each character.
- Take the next characterfor example U+0641, Arabic letter feh
- Does Noto Sans have it?YesUse Noto SansNoTry the next font
- Does Noto Sans SC have it?YesUse Noto Sans SCNoTry the next font
- Does Noto Naskh Arabic have it?YesUse Noto Naskh ArabicNoLog a missing glyph, fail the test
- Embed the used glyphs as a subsetthe PDF grows only a little
5 steps in order. Play them, or step through them one at a time.
3Right-to-Left Text Needs Shaping
Having the glyphs is not enough for Arabic and Hebrew. These scripts are written right to left, so a line that mixes an Arabic name with an invoice number must be reordered by the Unicode bidirectional algorithm, called bidi. Arabic letters also change shape depending on their position in a word (initial, middle, final or alone) and join to their neighbours. Turning a sequence of characters into the correct joined glyphs is called shaping. Without it, an Arabic name appears as separate, unjoined letters in reverse order, which is unreadable even though every glyph is present.
Some PDF libraries do no shaping or bidi at all, leaving it to us; others support it through an extra module, for example an add-on that uses ICU4J, the Java port of the International Components for Unicode; some commercial libraries offer it as a paid add-on. This is a point to check for our exact library and version, and then prove with a test, because it decides whether we can support these customers at all with the current tools.
4Making the PDFs Accessible
A screen reader reads a PDF through its tag tree, a hidden structure that says this is a heading, this is a paragraph, this is a table with these header cells, this image means our company logo. An untagged PDF is only drawing instructions: the reader may read text in drawing order, mix columns, and announce nothing useful for images. That is why the audit fails.
PDF/UA (ISO 14289) is the standard for accessible PDFs. In practice it requires a tagged PDF with a correct structure tree, alternative text for meaningful images and artifacts marked for decorative ones, a logical reading order, table headers marked as headers, the document language set (and changed for passages in other languages), a title in the metadata that viewers display, and fonts embedded with Unicode mappings so text can be extracted. HTML-to-PDF renderers help here because the HTML already has structure: OpenHTMLtoPDF can produce tagged PDF/UA output with a builder option (check the exact method in your version), and uses alt attributes and lang attributes from our template. We validate the output with a checker such as veraPDF, which tests PDF/UA rules automatically.
5Tests and Template Standards
We make the fix permanent with automated tests. A test fixture contains customers whose names cover the scripts we serve: Latin with accents, Cyrillic, Greek, Chinese, Japanese, Korean, Arabic, Hebrew, Devanagari, plus edge cases such as very long names and names that mix two scripts. For each template, the test generates a PDF and extracts the text with PDFBox's PDFTextStripper, asserting that every name comes back exactly; missing glyphs or broken mappings fail the test. For right-to-left names we add a rendered-image snapshot, reviewed once by someone who reads the script, and compare later runs against it. A veraPDF run in CI checks PDF/UA and, if needed, PDF/A.
Across the company, we turn this into template standards: an approved font set with fallback, shipped as a shared library or base template; required tagging, language and alt text; and the multi-script test suite that every document generator must run. That way a new template inherits the fix instead of rediscovering the bug.
6Follow-up questions
Why not convert names to Latin letters?
Because it is the customer's name. Transliteration loses information, can be offensive, and may be legally wrong on contracts or statements. Some systems print a Latin form in addition to the original where a regulation requires it, but never instead of it.
Do embedded CJK fonts make every PDF huge?
No, as long as the library subsets fonts, which mainstream libraries do by default. Only the glyphs used in the document are embedded, so a statement with a Chinese name adds a few kilobytes, not the full font file.
What does veraPDF check and what does it miss?
It checks the machine-verifiable rules of PDF/A and PDF/UA, such as tagging, embedded fonts and metadata. It cannot judge whether alt text is meaningful or whether the reading order makes sense, so we also do a manual check with a screen reader on each new template.
7Conclusion
In this answer, we saw that characters go missing when the PDF's fonts have no glyphs for a script, so we embed fonts such as the Noto families and configure a fallback chain. Arabic and Hebrew also need bidi reordering and shaping, which some libraries lack, so we check ours and add support. Accessibility requires tagged PDFs following PDF/UA, with structure, alt text, reading order and language. Automated tests with names in many scripts, veraPDF validation and company-wide template standards keep both problems fixed across every generator.
Open with
Missing characters mean the font in the PDF has no glyphs for those scripts; templates usually use a Latin font or one of the standard fonts like Helvetica, which only cover basic Western characters.
Then, if they want more
I'd embed fonts that cover what our customers use, such as Noto Sans plus Noto Sans SC for Chinese and Noto Naskh Arabic, and configure a fallback chain, which in an HTML renderer is just registering the fonts and listing them in font-family. Libraries embed only a subset, so file sizes stay small.
For Arabic, glyphs aren't enough: the text needs bidi reordering and shaping so letters join correctly, and some libraries don't do that, so I'd check ours and add its shaping support, for example through ICU4J, or change library.
For the accessibility audit, the PDFs need to be tagged following PDF/UA: a structure tree with headings and table headers, alt text for images, a logical reading order, the document language and a title. HTML templates make this easier because the structure is already there, and I'd validate with veraPDF in CI.
Then I'd add tests with names in many scripts that extract the text and compare it, plus image snapshots for right-to-left, and make the fonts, tagging and tests part of the shared template standard.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Generated PDFs show missing characters for customers with Chinese and Arabic names, and...": https://scrivio-interview-library.netlify.app/java/document-libraries/0080c6bdea/