I got into the iText codebase and realized that when setAppearance is
invoked on the PdfAnnotation object, internally, the logic checks for the
existence of the AP key in a dictionary and if not present, it generates all
the reqd stuff ....so, setAppearance seems to be doing whatever is
required...only thing is why it doesn't work on DOWN, whereas it works on
NORMAL... could this possibly be a bug in case of the screen annotation?

On Fri, Oct 7, 2011 at 12:55 PM, Manoj Karnavat <[email protected]> wrote:

> ok....i hv a few doubts after some trial and error that i have done so
> far...
>
> firstly, when i set the appearance using
>
> pa.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, ap);
>
> then i see 2 overlapping lines of text (which is understandable since this
> is the "Normal" appearance.)
> However, if I move ahead logically putting
>
> pa.setAppearance(PdfAnnotation.APPEARANCE_DOWN, ap);
>
> which is the appearance when the mouse is clicked in the annotation area,
> then the area still remains blacked-out, which ideally should have displayed
> some text when the area is clicked - so why this inconsistent behavior?
>
> secondly, i tried the "AP" dictionary also.
> When I create a PdfDictionary and try to put a value of the appearance
> object for the PdfAnnotation.APPEARANCE_DOWN key, it is not allowed since
> the dictionary object expects a PdfObject as a value
>
>
>                 PdfAppearance ap =
> writer.getDirectContent().createAppearance(rect.getWidth(),
> rect.getHeight());
>
>                 ap.beginText();
>                 ap.setFontAndSize(bf, 10);
>                 ap.showText(contents.getContent());
>                 ap.endText();
>
>                 PdfDictionary pd = new PdfDictionary();
>                 pd.put(PdfAnnotation.APPEARANCE_DOWN, ap);  // this is not
> allowed
>                 pa.put(PdfName.AP, pd);
>                 writer.addAnnotation(pa);
>
>
> pls advise
>
>
>
> On Fri, Oct 7, 2011 at 11:49 AM, 1T3XT BVBA <[email protected]> wrote:
>
>> On 6/10/2011 19:38, Manoj Karnavat wrote:
>> > I think I have come closer to the final aim with the foll code, but I
>> > strongly feel that some tiny bit is missing...can anyone pls help - i
>> > think im not getting the right PdfName in the setAppearance
>> > method...the documentation is bit confusing - i have done some amount
>> > of trial and error, but no luck so far....
>> You need to use the correct terminology.
>> You need to add an appearance dictionary (the /AP entry).
>> This dictionary should at least contain one "normal" appearance (an /N
>> entry in the /AP dictionary).
>> Other possible entries are /R for the "rollover" and /D for the "down"
>> appearance.
>> See 12.5.5 of ISO-32000-1.
>>
>>
>> ------------------------------------------------------------------------------
>> All of the data generated in your IT infrastructure is seriously valuable.
>> Why? It contains a definitive record of application performance, security
>> threats, fraudulent activity, and more. Splunk takes this data and makes
>> sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy2
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> iText(R) is a registered trademark of 1T3XT BVBA.
>> Many questions posted to this list can (and will) be answered with a
>> reference to the iText book: http://www.itextpdf.com/book/
>> Please check the keywords list before you ask for examples:
>> http://itextpdf.com/themes/keywords.php
>>
>
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to