I realize this question has been asked before (I looked at all the solutions and tried them all) but I am still trying to generate a pdf document with a header and footer th
Here is a working example:
package com.sg2net.test;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.xhtmlrenderer.pdf.ITextRenderer;
import com.lowagie.text.DocumentException;
public class XHTMLRenderer8 {
/**
* @author Giovanni Cuccu
*/
public static void main(String[] args) throws FileNotFoundException, DocumentException {
ITextRenderer renderer = new ITextRenderer();
String content="\n" +
"HeaderPage1Page2";
renderer.setDocumentFromString(content);
renderer.layout();
renderer.createPDF(new FileOutputStream("test.pdf"));
}
}
This is using the following XHTML document
Header
Page1
Page2