You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2024/12/17 10:43:00 UTC

[jira] [Updated] (PDFBOX-5923) The font "Droid Sans Armenian" throw an exception when rendering text

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

Tilman Hausherr updated PDFBOX-5923:
------------------------------------
    Attachment: screenshot-1.png

> The font "Droid Sans Armenian" throw an exception when rendering text
> ---------------------------------------------------------------------
>
>                 Key: PDFBOX-5923
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5923
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.32
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: DroidSansArmenian.ttf, image-2024-12-17-17-33-30-940.png, screenshot-1.png
>
>
> Using PDType0Font.load to load the attach font, it will throw an exception when rendering text.  !image-2024-12-17-17-33-30-940.png! 
> {code:java}
> try (PDDocument document = new PDDocument()) {
>             PDPage page = new PDPage();
>             document.addPage(page);
>             TrueTypeFont ttFont = new TTFParser().parse("DroidSansArmenian.ttf");
>             PDFont font = PDType0Font.load(document, ttFont, false);
>             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 (Exception e) {
>            e.printStackTrace();
>         }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org