I am trying to use PDFBox 2.0 (snapshot of 20151009) due to the availability of TTC support. But I haven't found any documentation on how to use this feature. I found a ticket here https://issues.apache.org/jira/browse/PDFBOX-2752 and I found how to load TTC file:
InputStream is = MyClass.class.getResourceAsStream("font.ttc");
TrueTypeCollection coll = new TrueTypeCollection(is);
but I don't know how to embed TrueTypeFont into my PDDocument. In PDFBox 1.8 I was using something similar to the following:
public String addFont(String key, PDFont font){
PDResources res = pdfForm.getDefaultResources();
if (res == null){
res = new PDResources();
}
String fontName = res.addFont(font);
pdfForm.setDefaultResources(res);
return fontName;
}
but know I have a TrueTypeFont not a PDFont. How can I "convert" a TrueTypeFont into PDFont ? Or am I using something in a wrong way ?
Thanks