You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Gilad Denneboom <gi...@gmail.com> on 2014/05/27 12:33:40 UTC

Differences between links added using PDFBox and Acrobat

Hi all,

So I'm trying to find the source for a problem with links added by PDFBox
disappearing from a file when it is encrypted (using DRM technology), when
links created in Acrobat remain in tact.
So I've created a test file and added a link to it manually in Acrobat Pro
XI and then I added some links using PDFBox. I then wrote a function that
outputs the full COSDictionary of each link in the file. The results can be
seen below:


Link created in Acrobat:
COSDictionary{(COSName{A}:COSDictionary{(COSName{D}:COSArray{[COSObject{10,
0}, COSName{XYZ}, COSInt{0}, COSInt{792}, COSFloat{0.0}]})
(COSName{S}:COSName{GoTo}) })
(COSName{BS}:COSDictionary{(COSName{S}:COSName{S})
(COSName{Type}:COSName{Border}) (COSName{W}:COSInt{1}) })
(COSName{Border}:COSArray{[COSInt{0}, COSInt{0}, COSInt{1}]})
(COSName{H}:COSName{I}) (COSName{Rect}:COSArray{[COSFloat{62.4294},
COSFloat{612.166}, COSFloat{177.97}, COSFloat{642.915}]})
(COSName{Subtype}:COSName{Link}) (COSName{Type}:COSName{Annot}) }

Link created using PDFBox:
COSDictionary{(COSName{Type}:COSName{Annot})
(COSName{Subtype}:COSName{Link})
(COSName{BS}:COSDictionary{(COSName{S}:COSName{S})
(COSName{W}:COSFloat{1.0}) }) (COSName{Rect}:COSArray{[COSFloat{72.03202},
COSFloat{485.31094}, COSFloat{171.39767}, COSFloat{498.8855}]})
(COSName{C}:COSArray{[COSFloat{0.0}, COSFloat{0.0}, COSFloat{0.0}]})
(COSName{H}:COSName{I})
(COSName{A}:COSDictionary{(COSName{Type}:COSName{Action})
(COSName{S}:COSName{GoTo}) (COSName{D}:COSArray{[COSObject{10, 0},
COSName{XYZ}, org.apache.pdfbox.cos.COSNull@433c675d,
org.apache.pdfbox.cos.COSNull@433c675d, COSInt{0}]}) }) }

As you can see, they are quite different. It almost seems as if in PDFBox
there's an object of some kind wrapped around the link annotation
(COSName{A}), which doesn't exist when you create it in Acrobat. Any ideas
on what might be causing this issue, how it can be fixed, and which version
is the correct one?

Thanks in advance!

Gilad