问题
I am working to create pdf using pdfbox 2.0 with the content available in datatable. While creating pdf some of the characters are not available in the font file.
Below exception thrown if any character not available in the font.
Note : AAAA indicate unicode character and BBBB is the font file in the exception block.
java.lang.IllegalArgumentException: No glyph for AAAA in font BBBB
at org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:411)
at org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:351)
at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286)
at com.font.test.FontTest.testFont(FontTest.java:140)
at com.font.test.FontTest.main(FontTest.java:103)
So, I planned to draw or replace with square in pdf if any character not available in the given font file.
Please help me to draw square in pdf if any character not available in the font file.
来源:https://stackoverflow.com/questions/56526107/how-to-draw-square-in-pdf-if-any-character-not-available-in-the-font-file-using