Forums Register Login

Add footer using iText version 5

+Pie Number of slices to send: Send
Hi,

I am trying to replace my old code for adding footer to a page to make it compatible with the new version(5.0.1), which does not support HeaderFooter class anymore. My existing code looks like this:

HeaderFooter footer = new HeaderFooter(new Phrase("page: "), true);
footer.setBorder(Rectangle.NO_BORDER);
footer.setAlignment(2);
document.setFooter(footer);

I am new to iText and not aware of the new(ver 5) way of doing this. Please advise. Thanks.
+Pie Number of slices to send: Send
Huh, they seem to have removed the introduction and example codes that used to be available on the iText site. I guess that means they *really* want folks to buy the book; not a particularly nice move (I very much liked the first edition of the book, though, it was worthwhile having for anyone using iText seriously). Nonetheless, they'll lose users over this.

Out of curiosity, why do you want to upgrade? Can iText 5 do things that iText 2 can't?
+Pie Number of slices to send: Send
I've updated the http://faq.javaranch.com/java/ItextExample example for iText 5; it demonstrates headers and footers, amongst other things.
+Pie Number of slices to send: Send
Also note that, according to iText's main developer, iText 5 is not yet stable, and the API might change well into the summer of this year. In other words, the time to make the switch has not yet come.
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 16730 times.
Similar Threads
Adding Header and Footer to an existing PDF
footer in itext how
How to add image in the footer of PDF
Headers and Footers are not appearing in saved PDF
How do I get A Footer on the First Page of a PDF Document
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:57:17.