[ 
https://issues.apache.org/jira/browse/PDFBOX-6015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

bai yuan updated PDFBOX-6015:
-----------------------------
    Description: 
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! 

  was:
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}



> 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
>            Priority: Major
>         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

Reply via email to