Hey there!

I am trying to use an OTF-font for creating a PDF with PDFBox 2.0.2 in Java 8.

I've tried different methods and read what google could find, but it was not that much to this topic: http://stackoverflow.com/questions/26651261/using-pdfbox-to-create-pdf-referencing-otf-fonts

|String pfbPath = "MyFont.otf"; PDFont font = new PDType1Font(doc, new FileInputStream(pfbPath)); |

Leaves a blank PDF, since I am using a .otf and not a .pfb.

This wont work either, PDFBox ignores the font and loads one of the standard fonts:

|PDType0Font font = PDType0Font.load(doc, new File("MyFont.otf")); |

||Implementing and using normal .ttf-files works fine, but I have no clue how to deal with an .otf.

I know that I simply could take an online-converter and create a .ttf-file from the .otf, but the font was created by an external company and their license does not seem to allow any modification to the font or the file itself.

Since the referenced StackOverflow-question is more than a year old, is it now somehow possible to use OTF-Fonts while creating a PDF?

Thanks in advance!

Kind regards,

Marcus

Reply via email to