How to draw square in pdf if any character not available in the font file using pdfbox

拟墨画扇 提交于 2019-12-11 15:58:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!