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 2019/11/05 06:05:00 UTC

[jira] [Commented] (PDFBOX-4678) Use PDFontFactory. CreateDefaultFont font to render text, the exported PDF document has a mistake

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

Tilman Hausherr commented on PDFBOX-4678:
-----------------------------------------

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