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

Julien Savoyet commented on PDFBOX-2162:
----------------------------------------

1) When I log the current content of my annotation on the eclipse console I see 
the following informations :

COSName{Type}: COSName{Annot}
COSName{Subtype}: COSName{Highlight}
COSName{QuadPoints}: COSArray{[COSFloat{94.0}, COSFloat{771.0}, 
COSFloat{194.0}, COSFloat{771.0}, COSFloat{94.0}, COSFloat{751.0}, 
COSFloat{194.0}, COSFloat{751.0}]}
COSName{C}: COSArray{[COSFloat{0.0}, COSFloat{0.0}, COSFloat{1.0}]}
COSName{CA}: COSFloat{0.5}
COSName{Rect}: COSArray{[COSFloat{94.0}, COSFloat{753.0}, COSFloat{194.0}, 
COSFloat{773.0}]}

2) After adding a piece of code about appearance like below :

PDAppearanceDictionary appearance = new PDAppearanceDictionary();
txtMark.setAppearance(appearance);

I see then that a new line {AP} relating to this appearance object is added in 
the dictionnary, that's OK :

COSName{Type}: COSName{Annot}
COSName{Subtype}: COSName{Highlight}
COSName{QuadPoints}: COSArray{[COSFloat{94.0}, COSFloat{771.0}, 
COSFloat{194.0}, COSFloat{771.0}, COSFloat{94.0}, COSFloat{751.0}, 
COSFloat{194.0}, COSFloat{751.0}]}
COSName{C}: COSArray{[COSFloat{0.0}, COSFloat{0.0}, COSFloat{1.0}]}
COSName{CA}: COSFloat{0.5}
COSName{Rect}: COSArray{[COSFloat{94.0}, COSFloat{753.0}, COSFloat{194.0}, 
COSFloat{773.0}]}
COSName{AP}: COSDictionary{(COSName{N}:COSDictionary{}) }

3) Now, If I open/save my PDF file with accrobat reader, I see that this AP 
line contains the following information : 

COSName{AP}: 
COSDictionary{(COSName{N}:COSDictionary{(COSName{BBox}:COSArray{[COSFloat{0.0}, 
COSFloat{0.0}, COSFloat{110.678}, COSFloat{21.25}]}) 
(COSName{FormType}:COSInt{1}) (COSName{Length}:COSInt{27}) 
(COSName{Matrix}:COSArray{[COSFloat{1.0}, COSFloat{0.0}, COSFloat{0.0}, 
COSFloat{1.0}, COSFloat{0.0}, COSFloat{0.0}]}) 
(COSName{Resources}:COSDictionary{(COSName{ExtGState}:COSDictionary{(COSName{R0}:COSDictionary{(COSName{AIS}:false)
 (COSName{CA}:COSFloat{0.5}) (COSName{Type}:COSName{ExtGState}) 
(COSName{ca}:COSFloat{0.5}) }) (COSName{R1}:COSDictionary{(COSName{AIS}:false) 
(COSName{BM}:COSName{Multiply}) (COSName{Type}:COSName{ExtGState}) }) }) 
(COSName{ProcSet}:COSArray{[COSName{PDF}]}) 
(COSName{XObject}:COSDictionary{(COSName{MWFOForm}:COSDictionary{(COSName{BBox}:COSArray{[COSFloat{0.0},
 COSFloat{0.0}, COSFloat{110.678}, COSFloat{21.25}]}) 
(COSName{FormType}:COSInt{1}) 
(COSName{Group}:COSDictionary{(COSName{S}:COSName{Transparency}) }) 
(COSName{Length}:COSInt{9}) (COSName{Matrix}:COSArray{[COSFloat{1.0}, 
COSFloat{0.0}, COSFloat{0.0}, COSFloat{1.0}, COSFloat{0.0}, COSFloat{0.0}]}) 
(COSName{Resources}:COSDictionary{(COSName{ProcSet}:COSArray{[COSName{PDF}]}) 
(COSName{XObject}:COSDictionary{(COSName{Form}:COSDictionary{(COSName{BBox}:COSArray{[COSFloat{88.6609},
 COSFloat{750.375}, COSFloat{199.339}, COSFloat{771.625}]}) 
(COSName{Filter}:COSName{FlateDecode}) (COSName{FormType}:COSInt{1}) 
(COSName{Length}:COSInt{84}) (COSName{Matrix}:COSArray{[COSFloat{1.0}, 
COSFloat{0.0}, COSFloat{0.0}, COSFloat{1.0}, COSFloat{-88.6609}, 
COSFloat{-750.375}]}) 
(COSName{Resources}:COSDictionary{(COSName{ProcSet}:COSArray{[COSName{PDF}]}) 
}) (COSName{Subtype}:COSName{Form}) (COSName{Type}:COSName{XObject}) }) }) }) 
(COSName{Subtype}:COSName{Form}) (COSName{Type}:COSName{XObject}) }) }) }) 
(COSName{Subtype}:COSName{Form}) (COSName{Type}:COSName{XObject}) }) }

So my problem is that I don't know how to fill these suitable information in 
the AP Dictionnary in order to comply with the obvious need of PDFBox to have 
it to make appear the annotation object in the final images generated...






> annotation that highlights a text is not visible in image (converted from the 
> pdf)
> ----------------------------------------------------------------------------------
>
>                 Key: PDFBOX-2162
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2162
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 1.8.6
>         Environment: Java 1.7 and Eclipse Kepler
>            Reporter: Julien Savoyet
>         Attachments: myfile1.pdf, myfile1_re_saved.pdf
>
>
> Hi, I'm trying to convert in images (png or jpeg) a PDF file in which I've 
> added an annotation within each page through the PDAnnotationTextMarkup 
> object.
> I've used PDFImageWriter to achieve this convertion and the images are 
> correctly generated excepted that the annotation has disappeared.
> It seems that there is a mistake because if for example I open my PDF file 
> with acrobat reader and then I re-save it under a new PDF file and then I 
> relaunch my image conversion script with this latter one, the images 
> generated will this time contain the annotations.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to