PdfBox-Android icon indicating copy to clipboard operation
PdfBox-Android copied to clipboard

How do I insert some Chinese text into the PDF

Open GodTreeV opened this issue 2 years ago • 1 comments

Hi! When I use PDType1Font.HELVETICA to save some Chinese text like "你好呀" to page 1, happened :

Caused by: java.lang.IllegalArgumentException: U+5965 ('.notdef') is not available in the font Helvetica, encoding: WinAnsiEncoding at com.tom_roush.pdfbox.pdmodel.font.PDType1Font.encode(PDType1Font.java:425) at com.tom_roush.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:333) at com.tom_roush.pdfbox.pdmodel.PDPageContentStream.showTextInternal(PDPageContentStream.java:508) at com.tom_roush.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:470) at com.tom_roush.pdfbox.sample.MainActivity2.loadFromPdfView(MainActivity2.kt:53) at com.tom_roush.pdfbox.sample.MainActivity2.onCreate(MainActivity2.kt:37) at android.app.Activity.performCreate(Activity.java:8232) at android.app.Activity.performCreate(Activity.java:8212) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1331)

So how can I save some Chinese text to pdf?

GodTreeV avatar Aug 24 '22 09:08 GodTreeV

change the font is the only solution

helloworq avatar Aug 25 '22 09:08 helloworq