[ 
https://issues.apache.org/jira/browse/PDFBOX-6172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18062097#comment-18062097
 ] 

Tilman Hausherr commented on PDFBOX-6172:
-----------------------------------------

I'm not sure if we support this type of fonts when creating PDFs. This is not a 
TrueType font. Maybe we do if it isn't subset.
I tested with the first character. Its unicode is 624B. That is gid 13927. That 
one looks like expected. The PDF has hex 36 67 which is 13927.
However, looking in the font software I found this:
 !screenshot-1.png! 
The CID is different. Your PDF has CIDToGIDMap Identity, maybe that is the 
problem?

> PDF displays garbled characters in Adobe Reader but renders correctly in web 
> browsers
> -------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-6172
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6172
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.35
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: NotoSansSC-Regular.otf, 
> image-2026-03-02-15-59-36-196.png, image-2026-03-02-16-00-28-488.png, 
> output.pdf, screenshot-1.png
>
>
> When exporting a PDF document, some characters appear as garbled text or 
> square boxes when the file is opened in Adobe Acrobat Reader. However, the 
> same PDF renders correctly when opened in web browsers such as Chrome or Edge.
> {code:java}
> try (PDDocument document = new PDDocument()) {
>     PDPage page = new PDPage();
>     document.addPage(page);
>     OpenTypeFont otf = new OTFParser().parse("NotoSansSC-Regular.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("手机号码");
>     contentStream.endText();
>     contentStream.close();
>     document.save("output.pdf");
> } catch (IOException e) {
>     e.printStackTrace();
> } {code}
> !image-2026-03-02-16-00-28-488.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]

Reply via email to