Search in sources :

Example 1 with PdfDocumentEvent

use of com.itextpdf.kernel.events.PdfDocumentEvent in project axelor-open-suite by axelor.

the class TableFooterEventHandler method handleEvent.

@SuppressWarnings("resource")
@Override
public void handleEvent(Event event) {
    PdfDocumentEvent docEvent = (PdfDocumentEvent) event;
    PdfDocument pdfDoc = docEvent.getDocument();
    PdfPage page = docEvent.getPage();
    PdfCanvas canvas = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc);
    Rectangle rect1 = new Rectangle(pdfDoc.getDefaultPageSize().getX() + doc.getLeftMargin(), pdfDoc.getDefaultPageSize().getBottom() - doc.getBottomMargin(), 100, 90);
    new Canvas(canvas, pdfDoc, rect1).add(tableFooter);
}
Also used : PdfDocumentEvent(com.itextpdf.kernel.events.PdfDocumentEvent) Canvas(com.itextpdf.layout.Canvas) PdfCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas) Rectangle(com.itextpdf.kernel.geom.Rectangle) PdfCanvas(com.itextpdf.kernel.pdf.canvas.PdfCanvas) PdfPage(com.itextpdf.kernel.pdf.PdfPage) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument)

Aggregations

PdfDocumentEvent (com.itextpdf.kernel.events.PdfDocumentEvent)1 Rectangle (com.itextpdf.kernel.geom.Rectangle)1 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)1 PdfPage (com.itextpdf.kernel.pdf.PdfPage)1 PdfCanvas (com.itextpdf.kernel.pdf.canvas.PdfCanvas)1 Canvas (com.itextpdf.layout.Canvas)1