pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (PDFBOX-4678) Use PDFontFactory. CreateDefaultFont font to render text, the exported PDF document has a mistake
Date Tue, 05 Nov 2019 06:08:00 GMT

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

Tilman Hausherr edited comment on PDFBOX-4678 at 11/5/19 6:07 AM:
------------------------------------------------------------------

Please try using {{PDType1Font.HELVETICA}} instead and tell whether that works. I have doubts
whether {{createDefaultFont}} is good for creating PDFs (at the very least, the method has
a poor javadoc), it was meant for rendering corrupted PDFs (PDFBOX-2222) and I see that it
references a font that may not exist on your machine (Arial). I don't have an error with Adobe
Reader, but I have the save problem with Chrome that you have.


was (Author: tilman):
Please try using {{PDType1Font.HELVETICA}} instead. I have doubts whether {{createDefaultFont}}
is good, it was meant for rendering corrupted PDFs (PDFBOX-2222) and I see that it references
a font that may not exist on your machine (Arial). I don't have an error with Adobe Reader,
but I have the save problem with Chrome.

> Use PDFontFactory. CreateDefaultFont font to render text, the exported PDF document has
a mistake
> -------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-4678
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4678
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: AdobeError.png, GoogleChrome.png, Test.zip
>
>
> Using PDFontFactory. CreateDefaultFont font to render a text and save this document.
> {code:java}
> float fontSize = 11;
> PDFont font = PDFontFactory.createDefaultFont(); 
> contentStream.beginText();  
> contentStream.newLineAtOffset(100, 100); 
> contentStream.setFont(font, fontSize);
> contentStream.showText("¥456,123"); 
> contentStream.endText();
> contentStream.close();
> doc.save("sample.pdf");{code}
> Open the PDF document with Abode and throw the following error message when editing the
document.
> !AdobeError.png!
> And i opened this pdf document using the Google browser as shown below:
> !GoogleChrome.png!
> [^Test.zip]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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


Mime
View raw message