java - Printing JPanel into PDF with itext without displaying it -
i have number of sheets contains numbers of jpanel. jpanels parents jtextpane, once panel visible can print pdf itext, if page not itext doesnt print panel. @ time of printing ducument created , contents added jtextpane , size of panel known too. hier print code public static void printcomponent(final jcomponent component, final rectangle bounds) throws documentexception, saxexception, ioexception, parserconfigurationexception { if (pdfcanvas == null) { return; } final rectangle alloc = new rectangle(component.getbounds().width, component.getbounds().height); pdfcanvas.savestate(); pdfcanvas.setleading(0); pdfcanvas.setcharacterspacing(0); final pdftemplate canvas = pdfcanvas.createtemplate(alloc.width, alloc.height); final fontmapper arialuni = new fontmapper() { @override public basefont awttopdf(final java.awt.font font) { //return basefont.... } @override public java.awt.