An appearance stream is not anymore complicated than a page content stream. 
Given PDFBox is about PDF, and given that the main 'feature' of PDF is 
representing page content, I have difficulty seeing the issue. An appearance 
stream is a mini page description, placed on top of the main page content. Not 
more, not less.  If a PDF fails to provide appearance streams where there 
should be one, it's essentially a deficit in the PDF.

> To get the annotation to display in anything other than acrobat, you actually 
> have to issue the draw (postscript) commands into the appearance stream (i.e. 
> move to position, draw line, draw text, et cetera). 

I would rephrase this: if the goal is to display an appearance where there is 
none, it needs to be generated by someone. This can happen on the fly, or by 
transcoding the annotation without an appearance stream into an annotation with 
an appearance stream. For some types of annotations it is relatively 
straightforward to generate one, for others it is more difficult, and for some 
it will be impossible. A fallback could be to display something visual along 
the lines of "Incomplete annotation", or an "empty" symbol, maybe with a red 
stop sign or something like that next to it.

Olaf

Am 3 Apr 2014 um 06:25 schrieb David VanderMolen <[email protected]>:

> Acrobat will display most (but not all) annotations without an /AP 
> (appearance stream) entry, but other pdf renderers will not.  To get the 
> annotation to display in anything other than acrobat, you actually have to 
> issue the draw (postscript) commands into the appearance stream (i.e. move to 
> position, draw line, draw text, et cetera).  It sounds like it should be 
> easy, but the reverse-engineering is horribly time consuming and imprecise.  
> It's easier to just specify "use acrobat"
> 
> DV
> On Monday, March 31, 2014 10:56 AM, Stan Taylor <[email protected]> wrote:
> 
> I am using PDFBox 2.0.0 downloaded from 
> http://svn.apache.org/repos/asf/pdfbox/trunk, PDFBox 1.8.4 downloaded from 
> http://www.apache.org/dyn/closer.cgi/pdfbox/1.8.4/pdfbox-1.8.4-src.zip , and 
> Adobe Reader v10.1.9 from http://adobe.com.
> 
> The result I am looking for is that the PDFBox app's PDFReader function be 
> able to display the PDF file created by the Annotation.java example provided 
> in the PDFBox examples.  A fix to either one would likely lead to a solution 
> to the more project-specific problems I am having.
> 
> Thanks!
> Stan
> 
> 
> -----Original Message-----
> From: Maruan Sahyoun [mailto:[email protected]] 
> Sent: Friday, March 28, 2014 11:54 PM
> To: [email protected]
> Subject: Re: Annotations not being rendered
> 
> Hi Stan,
> 
> where do you get the box (Adobe Reader, PDFBox, .) ? What is the expected 
> result you are looking for?
> 
> BR
> Maruan
> 
> Am 29.03.2014 um 00:12 schrieb Stan Taylor <[email protected]>:
> 
>> Thanks!  If it's so vital, I'm surprised that the PDFBox own Annotation 
>> example doesn't include it... What the easiest way to set a default 
>> appearance that allows the annotations to display?
>> 
>> I modified Annotation.java and tried creating a default appearance like this:
>> 
>>     PDAppearanceDictionary appearance = new PDAppearanceDictionary(new 
>> COSDictionary());
>> 
>>     ... and then called setAppearance(appearance) on each of my PDAnnotation 
>> objects
>> 
>> But this covers up the annotation's content with an opaque purple box.
>> 
>> 
>> -----Original Message-----
>> From: Olaf Drümmer [mailto:[email protected]] 
>> Sent: Friday, March 28, 2014 3:40 PM
>> To: [email protected]
>> Cc: Olaf Drümmer
>> Subject: Re: Annotations not being rendered
>> 
>> No appearance stream means no rendered appearance, unless some process kicks 
>> in that generates it.
>> 
>> Adobe Reader does have the habit to fill certain gaps, for example if the 
>> appearance stream for a highlight annotation is missing, it will simply 
>> generate one (there were versions of Adobe Reader that even did this when 
>> there already was an appearance stream - Adobe Reader then happily created 
>> one that didn't necessarily match the one that was actually there).
>> 
>> Olaf
>> 
>> 
>> Am 28 Mar 2014 um 23:00 schrieb Stan Taylor <[email protected]>:
>> 
>>> Nope; I don't see any in PDFDebugger and programmatically, 
>>> PDAnnotation.getAppearanceStream()  and PDAnnotation.getAppearance() return 
>>> null for all annotations obtained from the PDPage.
>>> 
>>> Stan
>>> 
>>> -----Original Message-----
>>> From: Olaf Drümmer [mailto:[email protected]] 
>>> Sent: Friday, March 28, 2014 2:48 PM
>>> To: [email protected]
>>> Cc: Olaf Drümmer
>>> Subject: Re: Annotations not being rendered
>>> 
>>> Do the annotations have an appearance (AP) entry?
>>> 
>>> Olaf
>>> 
>>> 
>>> Am 28 Mar 2014 um 21:17 schrieb "Stan Taylor" <[email protected]>:
>>> 
>>>> Is anyone else experience issues regarding annotations not being rendered? 
>>>>   Attached here are two PDF samples created from the 
>>>> /examples/src/main/java/org/apache/pdfbox/examples/pdmodel/Annotation.java 
>>>> example program from PDFBox 1.8.4 (stan1.pdf) and PDFBox 2.0.0 (stan2.pdf).
>>>> 
>>>> Viewing these PDFs in Adobe Reader (Windows v10), I can see the 
>>>> annotations fine, but the annotations don't show up when I use the PDFBox 
>>>> app's PDFReader feature from either version of PDFBox.  The annotations 
>>>> are likewise not visible when I render the (first and only) page to an 
>>>> image, via PDPage.convertToImage() in PDFBox 1.8.4 or via PDFRender. 
>>>> renderImageWithDPI() in PDFBox 2.0.0.
>>>> 
>>>> The original problem I was investigating was why annotations created by 
>>>> another PDF package were not showing up, but now I am realizing that 
>>>> annotations generated by PDFBox's own example program don't render either?!
>>>> 
>>>> And ideas/recommendations?
>>>> 
>>>> Thanks,
>>>> Stan
>>>> 
>>> 
>>> 
>>> Cloud Services for Business www.j2.com
>>> j2 | eFax | eVoice | FuseMail | Campaigner | KeepItSafe | Onebox
>>> 
>>> 
>>> This email, its contents and attachments contain information from j2 
>>> Global, Inc. and/or its affiliates which may be privileged, confidential or 
>>> otherwise protected from disclosure. The information is intended to be for 
>>> the addressee(s) only. If you are not an addressee, any disclosure, copy, 
>>> distribution, or use of the contents of this message is prohibited. If you 
>>> have received this email in error please notify the sender by reply e-mail 
>>> and delete the original message and any copies. (c) 2013 j2 Global, Inc. 
>>> All rights reserved. eFax, eVoice, Campaigner, FuseMail, KeepItSafe, and 
>>> Onebox are registered trademarks of j2 Global, Inc. and its affiliates.
>>> 

Reply via email to