bai yuan created PDFBOX-6015:
--------------------------------

             Summary: 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
    Affects Versions: 2.0.32
            Reporter: bai yuan
         Attachments: Keyboard.ttf

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}




--
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

Reply via email to