pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamena314 <hamena...@freenet.de>
Subject How to implement OTF-fonts into a PDF with Apache PDFBox 2.x?
Date Tue, 16 Aug 2016 19:25:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message