Hi Bruno/Paulo (or mailing list users whom it may concern):
As people are not to keen to be contacted directly, I've had to post this here,
so apologies if it's wrong in advance (as I'm not registered with the mailing
list yet). This is not a question, I'm merely trying to be helpful with people
getting error's with 'unbalanced states' trying to run the example program
supplied.
I was looking at your example for page numbering and total pages example (as
I'll be looking to put page numbering + total pages, mid page rather than in
the footer), and the code example shown is seemingly incorrect (sorry if this
is not the case).
To get it running I had to add in an extra cb.restoreState() into an else block
(as shown just above the cb.sanityCheck() ):-
// starting on page 3, a watermark with an Image that is made
transparent
if (writer.getPageNumber() >= 3) {
cb.setGState(gstate);
cb.setColorFill(Color.red);
cb.beginText();
cb.setFontAndSize(helv, 48);
cb.showTextAligned(Element.ALIGN_CENTER, "Watermark Opacity " +
writer.getPageNumber(), document.getPageSize().getWidth() / 2,
document.getPageSize().getHeight() / 2, 45);
cb.endText();
try {
cb.addImage(headerImage, headerImage.getWidth(), 0, 0,
headerImage.getHeight(), 440, 80);
}
catch(Exception e) {
throw new ExceptionConverter(e);
}
cb.restoreState();
} else {
cb.restoreState();
}
cb.sanityCheck();
}
All the best :)
Regards,
Matthew Wain
Software Engineer
UK.
Land Registry's House Price Index is now live. www.landregistry.gov.uk
If you have received this e-mail and it was not intended for you, please let us
know, and then delete it. Please treat our communications in confidence, as you
would expect us to treat yours. Land Registry checks all mail and attachments
for known viruses, however, you are advised that you open any attachments at
your own risk.
The original of this email was scanned for viruses by the Government Secure
Intranet virus scanning service supplied by Cable&Wireless in partnership with
MessageLabs. (CCTM Certificate Number 2009/09/0052.) On leaving the GSi this
email was certified virus free.
Communications via the GSi may be automatically logged, monitored and/or
recorded for legal purposes.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
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/