[ https://issues.apache.org/jira/browse/PDFBOX-6015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr updated PDFBOX-6015: ------------------------------------ Fix Version/s: 2.0.35 3.0.6 PDFBox 4.0.0 > Load a TTF font which is from Mac OS throw an exception > ------------------------------------------------------- > > Key: PDFBOX-6015 > URL: https://issues.apache.org/jira/browse/PDFBOX-6015 > Project: PDFBox > Issue Type: Bug > Components: FontBox > Affects Versions: 2.0.32, 2.0.34, 3.0.5 PDFBox > Reporter: bai yuan > Priority: Major > Fix For: 2.0.35, 3.0.6 PDFBox, 4.0.0 > > Attachments: Keyboard.ttf, screenshot-1.png > > > Using PDType0Font.load to load a font which is from Mac OS, it throws an > exception: > {code:java} > try (PDDocument document = new PDDocument()) { > PDPage page = new PDPage(); > document.addPage(page); > TrueTypeFont ttFont = new TTFParser().parse(new > File("Keyboard.ttf")); > PDFont font = PDType0Font.load(document, ttFont, true); > PDPageContentStream contentStream = new > PDPageContentStream(document, page); > contentStream.beginText(); > contentStream.setFont(font, 12); > contentStream.newLineAtOffset(100, 700); > contentStream.showText("abc"); > contentStream.endText(); > contentStream.close(); > document.save("output.pdf"); > } catch (IOException e) { > e.printStackTrace(); > } > {code} > The exception as follows: > !screenshot-1.png! -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org