1

I want to add a Header or a Footer on the first page of my PDF. I have tried to set it just after construct the Document. But, it was inneficient.

I also have thought of passing the first page and delete it at the end. But, I haven't managed it yet... :(

Has someone a solution ?

Thanks.

cesarmarch
  • 617
  • 4
  • 13
  • Droidtext is based on an iText version that is no longer supported. It's not endorsed by the original authors of iText, please use the official Android port of iText: http://itextsupport.com/download/android.html – Bruno Lowagie Mar 29 '13 at 15:50

1 Answers1

1

Following code may useful to you:

Set Header:

//open the document
doc.open();

//set header
Phrase headerText = new Phrase("This is an example of a Header");
HeaderFooter pdfHeader = new HeaderFooter(headerText, false);
doc.setHeader(pdfHeader);

Set Footer:

//set footer
Phrase footerText = new Phrase("This is an example of a footer");
HeaderFooter pdfFooter = new HeaderFooter(footerText, false);
doc.setFooter(pdfFooter);

//close doc
doc.close();
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437