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 2023/10/12 03:04:00 UTC
[jira] [Comment Edited] (PDFBOX-5696) COSStream lost, becomes a COSDictionary
[ https://issues.apache.org/jira/browse/PDFBOX-5696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774301#comment-17774301 ]
Tilman Hausherr edited comment on PDFBOX-5696 at 10/12/23 3:03 AM:
-------------------------------------------------------------------
Thanks. Sadly the error still happens with the original code from Pados Attila, it turns out I had found a different bug (the one here) by trying to simplify his code. His actual bug is related to PDFBOX-5489 but he used addPage instead of importPage. I'll write something in the user list, in the "empty/missing pdf content" thread.
was (Author: tilman):
Thanks. Sadly the error still happens with the original code from Pados Attila, it turns out I had found a different bug (the one here) by trying to simplify his code. His actual bug is related to PDFBOX-5489 but he used addPage instead of importPage. I'll write something in the user list.
> COSStream lost, becomes a COSDictionary
> ---------------------------------------
>
> Key: PDFBOX-5696
> URL: https://issues.apache.org/jira/browse/PDFBOX-5696
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 3.0.0 PDFBox
> Reporter: Tilman Hausherr
> Assignee: Andreas Lehmkühler
> Priority: Critical
> Fix For: 3.0.1 PDFBox, 4.0.0
>
> Attachments: 30-1.pdf, 30-2.pdf, CambriaMath.ttf, TemplateTank.pdf
>
>
> This is reduced from the example presented by Pados Attila on the mailing list
> {code}
> public static void main(String[] args) throws IOException
> {
> InputStream resourceAsStream = NewClass.class.getResourceAsStream("/pdf/TemplateTank.pdf");
> try (PDDocument a1doc = Loader.loadPDF(new RandomAccessReadBuffer(resourceAsStream)))
> {
> PDAcroForm form = a1doc.getDocumentCatalog().getAcroForm();
> PDResources dr = form.getDefaultResources();
> form.getField("Site Name").setValue("Site Name");
> a1doc.save(new File("30-1.pdf"));
> PDFont font = PDType0Font.load(a1doc, PdfGenerator.class.getResourceAsStream("/fonts/CambriaMath.ttf"), false);
> dr.add(font);
> a1doc.save(new File("30-2.pdf"));
> }
> }
> {code}
> The result file 30-1.pdf has "Site Name" in the rendering, the result file 30-2.pdf doesn't, because the appearance stream is now a dictionary.
> (The test was done on jdk21, I didn't test on another jdk)
--
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