diff --git a/org.adempiere.base/src/org/adempiere/pdf/Document.java b/org.adempiere.base/src/org/adempiere/pdf/Document.java index 3900ca4883..3d657aa49f 100644 --- a/org.adempiere.base/src/org/adempiere/pdf/Document.java +++ b/org.adempiere.base/src/org/adempiere/pdf/Document.java @@ -74,13 +74,14 @@ public class Document { document.newPage(); } - final PdfTemplate tp = cb.createTemplate(w, h); - final Graphics2D g2 = tp.createGraphics(w, h, mapper); + PdfTemplate tp = cb.createTemplate(w, h); + Graphics2D g2 = tp.createGraphics(w, h, mapper); tp.setWidth(w); tp.setHeight(h); pageable.getPrintable(page).print(g2, pf, page); g2.dispose(); cb.addTemplate(tp, 0, 0); + writer.releaseTemplate(tp); } document.close();