You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "the blue mountain (Jira)" <ji...@apache.org> on 2022/01/30 13:38:00 UTC
[jira] [Comment Edited] (PDFBOX-5369) PDDocument.saveIncremental () and stack exhaustion
[ https://issues.apache.org/jira/browse/PDFBOX-5369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17484335#comment-17484335 ]
the blue mountain edited comment on PDFBOX-5369 at 1/30/22, 1:37 PM:
---------------------------------------------------------------------
Herr Lekhmkühler,
A: i have update the sample code to replace instances of COSObject with related object and i am no longer encountering the issue: thank you again for your effective help.
(see the updated Sample.java class)
B: i do confirm about duplicate items written in the output.
file mini_merged-SNAP.pdf correspond to SNAPSHOT i had and it shows object(s) being written multiple times.
I have altered the COSWriter:write (PDDocument, SignatureInterfaces) to try to correct the behavior and Sample class now generates the mini_merged_SNAP-fixed.pdf file.
Q: is this duplication issue still caused by the Sample class ?
(note: files being referred to are located in PDFBOX-20220130.zip attachment)
Thank you,
was (Author: JIRAUSER284189):
Herr Lekhmkühler,
A: i have update the sample code to replace instances of COSObject with related object and i am no longer encountering the issue: thank you again for your effective help.
(see the updated Sample.java class)
B: i do confirm about duplicate items written in the output.
file mini_merged-SNAP.pdf correspond to SNAPSHOT i had and it shows object(s) being written multiple times.
I have altered the COSWriter:write (PDDocument, SignatureInterfaces) to try to correct the behavior and Sample class now generates the mini_merged_SNAP-fixed.pdf file.
Q: is this duplication issue still caused by the Sample class ?
Thank you,
> PDDocument.saveIncremental () and stack exhaustion
> --------------------------------------------------
>
> Key: PDFBOX-5369
> URL: https://issues.apache.org/jira/browse/PDFBOX-5369
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 3.0.0 PDFBox
> Reporter: the blue mountain
> Priority: Major
> Attachments: PDFBOX-20220126.zip, PDFBOX-20220130.zip
>
>
> Merge of fdf annotations into pdf file exhausts stack
> attempting to merge an fdf file in a pdf file, using the PDDocument.saveIncremental () method, program stack is exhausted because of infinite recursion.
> looking further in the code, it seems the infinite recursion is being started from the private boolean COSIncremental.collect(COSBase base) method.
> i have attached a zip file carrying:
> - mini.pdf: a minimal pdf file to reproduce the issue
> - mini.fdf: an fdf annotation file carrying a /Text annotation and related /Popup to reproduce the issue
> - COSIncrement.java: a modified source that generate extra traces (+ possible work-around)
> - COSIncrement-fix.java: a modified source to avoid the problem
> - Sample.java: a sample program that loads pdf, copies annotations and saves incrementally.
> - sample_run.xlsx: an extract of the Sample output to compare a working vs non-working
>
> notes:
> 1- I was not able to reproduce the problem using annotations created dynamically in the code.
>
> 2- It is possible to avoid this issue by altering the COSIncrement.java class (COSIncrement-fix.java):
> it records objects beING collected through enter () method ensuring object is not being collected multiple times
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org