I cannot seem to figure this one out.  I am following the example in the
book, and everything works great, except for a significant side effect. 
Whenever I put a watermark on my page (in the onEndPage event), the content
of the page is bold.  My only guess is that it is somehow stamping the page
onto itself.  This may not be what is happening, but its my best guess...  I
have compared two documents side-by-side with and without the watermark, and
every page that has the watermark has this problem.

Here's the context: In my event, I use writer.getDirectContent() to get the
ContentByte (declared as cb).  I then use that to draw borders in the header
and footer and to put the header and footer text in the document.  After
that is done, I use the same cb variable to draw a watermark if the document
has a watermark.  I am saving the cb state when I start the header/footer
method and restoring it before I create the watermark (the watermark code is
below).  Then I create the watermark, as follows:

/************ BEGIN CODE **************/
cb.saveState();
PdfGState gState = new PdfGState();
opacity = 0.6;
// some logic removed that sets the opacity to another float
gState.setFillOpacity(opacity);
gState.setStrokeOpacity(opacity);

cb.setGState(gState);
// this color is getting set correctly, but it is coming from a separate
class
cb.setColorFill(watermarkStyle.color);
cb.beginText();
cb.setFontAndSize(watermarkFont,  watermark.textStyle.fontSize);

cb.showTextAligned(Element.ALIGN_CENTER, pageBg.watermark.text,
document.getPageSize().width() / 2.0, document.getPageSize().height() / 2.0,
watermark.rotation);
cb.endText();
cb.restoreState();

/************ END CODE **************/

I have tried 20 different things, and I can't get there.  Any help is much
appreciated...
-- 
View this message in context: 
http://old.nabble.com/Watermark-causing-page-to-be-bold-%28stamped-on-itself-%29-tp27376197p27376197.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to