Example usage for com.itextpdf.text.pdf PdfWriter getPageEvent

List of usage examples for com.itextpdf.text.pdf PdfWriter getPageEvent

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfWriter getPageEvent.

Prototype


public PdfPageEvent getPageEvent() 

Source Link

Document

Gets the PdfPageEvent for this document or null if none is set.

Usage

From source file:com.vectorprint.report.itext.style.DefaultStylerFactory.java

License:Open Source License

@Override
public void setDocument(Document document, com.itextpdf.text.pdf.PdfWriter writer) {
    this.document = document;
    this.writer = writer;
    if (settings.containsKey(PAGESTYLERS)) {
        try {/*  w  w w .  j  a  v  a 2 s.co m*/
            EventHelper ph = (EventHelper) writer.getPageEvent();
            // init page stylers
            Collection<BaseStyler> p = getParameterizables(PAGESTYLERS, STYLERPACKAGENAME);
            for (BaseStyler s : p) {
                if (s instanceof Advanced) {
                    ph.addStylerForEachPage((Advanced) s);
                } else {
                    log.warning(s.getClass().getSimpleName()
                            + " is not an advanced styler, cannot be used for each page");
                }
            }
            styleSetup.put(PAGESTYLERS, ParamBindingService.getInstance().getFactory().getBindingHelper()
                    .serializeValue(settings.getStringProperties(null, PAGESTYLERS)));
        } catch (VectorPrintException ex) {
            throw new VectorPrintRuntimeException(ex);
        }
    }
}