[ 
https://issues.apache.org/jira/browse/PDFBOX-5714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Derek Wickern updated PDFBOX-5714:
----------------------------------
    Description: 
{{basic-sticky-note.fdf}} contains an Acrobat "sticky note", which consists of 
two annotations: text (2 0 obj) and popup (3 0 obj). The annotations reference 
each other. The text annotation's "/Popup 3 0 R" references the popup 
annotation. The popup's "/Parent 2 0 R" references the text annotation.

 
{code:java}
2 0 obj
<<... /Popup 3 0 R ...>>
endobj
3 0 obj
<<... /Parent 2 0 R ...>>
endobj
{code}
 

The attached Java program copies those annotations onto {{{}w4.pdf{}}}, saves 
the file, then reads it back to verify the result.
h3. Expected Behavior

{{out-pdfbox2.pdf}} is the output using pdfbox 2.0.30. The annotation objects 
are reassigned to some available ID:

 
{code:java}
38 0 obj
<< ... /Popup 39 0 R ... >>
endobj
39 0 obj
<< ... /Parent 38 0 R ...>>
endobj
{code}
 

The program outputs:
{code:java}
correct parent? true
correct popup? true{code}
h3. Actual Behavior

{{out-pdfbox3.pdf}} is the output using pdfbox 3.0.0. The objects are assigned 
a new ID but their references are unchanged, so the /Popup and /Parent 
reference some other arbitrary object:

 
{code:java}
3473 0 obj
<< ... /Popup 3 0 R ... >>
endobj
3474 0 obj
<< ... /Parent 2 0 R ...>>
endobj
{code}
 

The program crashes since the dereferenced /Parent is not an annotation:
{code:java}
Exception in thread "main" java.lang.ClassCastException: class 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown cannot be 
cast to class 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup 
(org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown and 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup are in 
unnamed module of loader 'app')
    at 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup.getParent(PDAnnotationPopup.java:99)
    at 
PdfboxAnnotationRegressionTest.main(PdfboxAnnotationRegressionTest.java:45) 
{code}
 

 

  was:
{{basic-sticky-note.fdf }}contains an Acrobat "sticky note", which consists of 
two annotations: text (2 0 obj) and popup (3 0 obj). The annotations reference 
each other. The text annotation's "/Popup 3 0 R" references the popup 
annotation. The popup's "/Parent 2 0 R" references the text annotation.

 
{code:java}
2 0 obj
<<... /Popup 3 0 R ...>>
endobj
3 0 obj
<<... /Parent 2 0 R ...>>
endobj
{code}
 

The attached Java program copies those annotations onto {{{}w4.pdf{}}}, saves 
the file, then reads it back to verify the result.
h3. Expected Behavior

{{out-pdfbox2.pdf}} is the output using pdfbox 2.0.30. The annotation objects 
are reassigned to some available ID:

 
{code:java}
38 0 obj
<< ... /Popup 39 0 R ... >>
endobj
39 0 obj
<< ... /Parent 38 0 R ...>>
endobj
{code}
 

The program outputs:
{code:java}
correct parent? true
correct popup? true{code}
h3. Actual Behavior

{{out-pdfbox3.pdf}} is the output using pdfbox 3.0.0. The objects are assigned 
a new ID but their references are unchanged, so the /Popup and /Parent 
reference some other arbitrary object:

 
{code:java}
3473 0 obj
<< ... /Popup 3 0 R ... >>
endobj
3474 0 obj
<< ... /Parent 2 0 R ...>>
endobj
{code}
 

The program crashes since the dereferenced /Parent is not an annotation:
{code:java}
Exception in thread "main" java.lang.ClassCastException: class 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown cannot be 
cast to class 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup 
(org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown and 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup are in 
unnamed module of loader 'app')
    at 
org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup.getParent(PDAnnotationPopup.java:99)
    at 
PdfboxAnnotationRegressionTest.main(PdfboxAnnotationRegressionTest.java:45) 
{code}
 

 


> PDFBox 3.0 regression: duplicate references in dictionary values
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-5714
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5714
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 3.0.0 PDFBox
>         Environment: macOS 14, Java 11
>            Reporter: Derek Wickern
>            Priority: Major
>         Attachments: PdfboxAnnotationRegressionTest.java, 
> basic-sticky-note.fdf, out-pdfbox2.pdf, out-pdfbox3.pdf, w4.pdf
>
>
> {{basic-sticky-note.fdf}} contains an Acrobat "sticky note", which consists 
> of two annotations: text (2 0 obj) and popup (3 0 obj). The annotations 
> reference each other. The text annotation's "/Popup 3 0 R" references the 
> popup annotation. The popup's "/Parent 2 0 R" references the text annotation.
>  
> {code:java}
> 2 0 obj
> <<... /Popup 3 0 R ...>>
> endobj
> 3 0 obj
> <<... /Parent 2 0 R ...>>
> endobj
> {code}
>  
> The attached Java program copies those annotations onto {{{}w4.pdf{}}}, saves 
> the file, then reads it back to verify the result.
> h3. Expected Behavior
> {{out-pdfbox2.pdf}} is the output using pdfbox 2.0.30. The annotation objects 
> are reassigned to some available ID:
>  
> {code:java}
> 38 0 obj
> << ... /Popup 39 0 R ... >>
> endobj
> 39 0 obj
> << ... /Parent 38 0 R ...>>
> endobj
> {code}
>  
> The program outputs:
> {code:java}
> correct parent? true
> correct popup? true{code}
> h3. Actual Behavior
> {{out-pdfbox3.pdf}} is the output using pdfbox 3.0.0. The objects are 
> assigned a new ID but their references are unchanged, so the /Popup and 
> /Parent reference some other arbitrary object:
>  
> {code:java}
> 3473 0 obj
> << ... /Popup 3 0 R ... >>
> endobj
> 3474 0 obj
> << ... /Parent 2 0 R ...>>
> endobj
> {code}
>  
> The program crashes since the dereferenced /Parent is not an annotation:
> {code:java}
> Exception in thread "main" java.lang.ClassCastException: class 
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown cannot 
> be cast to class 
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup 
> (org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationUnknown and 
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup are in 
> unnamed module of loader 'app')
>     at 
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup.getParent(PDAnnotationPopup.java:99)
>     at 
> PdfboxAnnotationRegressionTest.main(PdfboxAnnotationRegressionTest.java:45) 
> {code}
>  
>  



--
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