You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "bai yuan (Jira)" <ji...@apache.org> on 2023/01/03 05:50:00 UTC

[jira] [Updated] (PDFBOX-5556) The font name displayed in the exported PDF is incorrect

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

bai yuan updated PDFBOX-5556:
-----------------------------
    Attachment: fontName.png

> The font name displayed in the exported PDF is incorrect
> --------------------------------------------------------
>
>                 Key: PDFBOX-5556
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5556
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.24
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: Swiss 721 Bold BT.ttf, fontName.png, test.pdf
>
>
> Load the attach ttf font and save this document
> {code:java}
> PDDocument doc = new PDDocument();
> PDPage page = new PDPage();
> doc.addPage(page);
> PDPageContentStream stream = new PDPageContentStream(doc, page);
> TrueTypeFont ttFont = new TTFParser().parse("resources//fonts//Swiss 721 Bold BT.ttf");
> PDFont font = PDType0Font.load(doc, ttFont, true);
> stream.setFont(font, 14);
> stream.beginText();
> stream.newLineAtOffset(100, 700);
> stream.setNonStrokingColor(Color.BLACK);
> String text = "Lazy dog";
> stream.showText(text);
> stream.endText();
> stream.stroke();
> stream.close();
> doc.save("test.pdf");
> doc.close(); {code}
> Open the exported document with Adobe Acrobat Pro, the font name is incorrect. It should be "Swis721 BT", but it is "Swiss 72 1 BT".



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