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

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

You can change it in {{OS2WindowsMetricsTable.setWeightClass()}} but it's still 
the same looks. This is informational.

> 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