Hello,
I am using PDFBox 2.0 dev snapshot to support Unicode characters. I have
few questions:
I want to write an existing PDF file which have few PDTextField with
Unicode characters.
I am using PDType0Font to load an external .ttf file
(Arial-Unicode-Regular.ttf) and setting the new font object to the
PDResources. Code snippet below:
PDType0Font font = PDType0Font.load(pdfDocument, new
File("Arial-Unicode-Regular.ttf"));
// Add and set the resources and default appearance at the form level
PDResources res = new PDResources();
COSName fontName = res.add(font);
acroForm.setDefaultResources(res);
String da = "/" + fontName.getName() + " 12 Tf 0 g";
acroForm.setDefaultAppearance(da);
But I am getting below exception
java.io.IOException: Could not find font: /CourierNewPSMT
at
org.apache.pdfbox.pdmodel.interactive.form.PDAppearanceString.getFont(PDAppearanceString.java:126)
I saw a similar ticket - https://issues.apache.org/jira/browse/PDFBOX-2848
*My questions:*
1. Does PDFBox 2.0 supports Unicode characters values to be set on an
existing PDF file which has PDTextField using setValue(String value) of the
PDTextField? I saw an example where Unicode characters are supported but
that PDF is created from scratch and it did not have AcroForms.
2. Will the .ttf file currently in sources of /
pdfbox/src/main/resources/org/apache/pdfbox/resources/ttf/ be packaged with
the final PDFBox jar? or the developers have to load it externally?
Appreciate your help.
Thanks,
Rakshit