Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] PdfPageEventHelper Question

Bruno

2007-08-16


Tom Pessler wrote:
> I used the PageXofY.java example to create a
> PdfPageEventHelper class. It works good for the page
> number and a "DEMO" watermark. I am generating this
> PDF from a servlet.
>
> There is 1 more feature that I need, for certain pages
> I need to add an additional watermark("ASSUMES
> SURRENDER"). At the time the page is generated I know
> if it needs this watermark. What I want to do is add
> the watermark in the onEndPage method, so that method
> needs to know when to add the watermark. I tried to
> "re-use" the document property Html Style Class. I
> would set it to a particular value in the servlet,
> then check for this value in the onEndPage method.
> But the value is always null in onEndPage method. Is
> there any other technique for doing this? Is there
> something I need to do to get the onEndPage method to
> see my "servlet updated" value of the Html Style
> Class.

I don't know if I understand the question.
Why don't you use a member variable in your subclass
of PdfPageEventHelper. Create an instance of your
custom page event class and make sure you have a
setter that allows you to change the value of the
variable. Check this value in the onEndPage method
to make whatever decision is needed (add a watermark,
don't add a watermark, add something else,...).

br,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.