[
https://issues.apache.org/jira/browse/PDFBOX-5922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr closed PDFBOX-5922.
-----------------------------------
Resolution: Not A Bug
> An exception was thrown when an OTF font file was parser
> --------------------------------------------------------
>
> Key: PDFBOX-5922
> URL: https://issues.apache.org/jira/browse/PDFBOX-5922
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.24
> Reporter: bai yuan
> Priority: Major
> Attachments: Cantarell-VF.otf, Cantarell-VF.pdf,
> image-2024-12-17-15-06-23-047.png
>
>
> Using OTFParser to parse the attach font file, it will throw an exception.
> {code:java}
> try (PDDocument document = new PDDocument()) {
> PDPage page = new PDPage();
> document.addPage(page);
>
> OpenTypeFont otf = new OTFParser().parse("Cantarell-VF.otf");
> PDFont font = PDType0Font.load(document, otf, false);
>
> PDPageContentStream contentStream = new
> PDPageContentStream(document, page);
> contentStream.beginText();
> contentStream.setFont(font, 12);
> contentStream.newLineAtOffset(100, 700);
> contentStream.showText("Hello, this is a test with OTF font!");
> contentStream.endText();
> contentStream.close();
>
> document.save("output.pdf");
> } catch (IOException e) {
> e.printStackTrace();
> }
> {code}
> !image-2024-12-17-15-06-23-047.png!
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]