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

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

Introduction

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

Prototype

public void releaseTemplate(final PdfTemplate tp) throws IOException 

Source Link

Document

Use this method to releases the memory used by a template.

Usage

From source file:net.atomique.ksar.export.FilePDF.java

License:Open Source License

private void addchart(PdfWriter writer, Graph graph) {
    JFreeChart chart = graph.getgraph(mysar.myparser.getStartOfGraph(), mysar.myparser.getEndOfGraph());
    PdfTemplate pdftpl = pdfcb.createTemplate(pagewidth, pageheight);
    Graphics2D g2d = new PdfGraphics2D(pdftpl, pagewidth, pageheight);
    Double r2d = new Rectangle2D.Double(0, 0, pagewidth, pageheight);
    chart.draw(g2d, r2d);/*w ww . j ava 2 s .  c o m*/
    g2d.dispose();
    pdfcb.addTemplate(pdftpl, pdfmargins, pdfmargins);
    try {
        writer.releaseTemplate(pdftpl);
    } catch (IOException ioe) {
        log.error("Unable to write to : {}", pdffilename);
    }
}