PdfPageEvent: page end
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfPageEventHelper;
import com.lowagie.text.pdf.PdfWriter;
public class OnEndPageEventPDF extends PdfPageEventHelper {
public static void main(String[] args)
{
Document document = new Document(PageSize.A4, 50, 50, 70, 70);
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("OnEndPageEventPDF.pdf"));
writer.setPageEvent(new OnEndPageEventPDF());
document.open();
document.add(new Paragraph("text"));
document.close();
}
catch (Exception de) {
de.printStackTrace();
}
}
public void onEndPage(PdfWriter writer, Document document) {
System.out.println("on page end event call back");
}
}
itext.zip( 1,748 k)Related examples in the same category