You need to clean up the graphics2d object: graphics.dispose(); --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null;
> -----Original Message----- > From: EMP [mailto:jthom...@emplicity.com] > Sent: Wednesday, June 09, 2010 9:42 AM > To: itext-questions@lists.sourceforge.net > Subject: Spam: [iText-questions] Error when using createGraphics > > > I was writing code to put an SVG image into a pdf and I kept getting an > error > message: "Unbalanced save/restore state operators.". I put together a > short > block of code to reproduce the error. > > try{ > PdfReader pReader = new > PdfReader("e:\\Tomcat\\webapps\\pdf\\in\\12345.pdf"); > PdfStamper stamper = new PdfStamper(pReader, new > FileOutputStream("e:\\Tomcat\\webapps\\pdf\\out\\12345.pdf")); > PdfContentByte contentByte = stamper.getOverContent(1); > PdfTemplate template = contentByte.createTemplate(318.5f, 39.0f); > Graphics2D graphics = template.createGraphics(318.5f, 39.0f); > stamper.close(); > }catch(Exception e){ > out.println(e.getMessage()); > } > > -- > View this message in context: http://itext- > general.2136553.n4.nabble.com/Error-when-using-createGraphics- > tp2249138p2249138.html > Sent from the iText - General mailing list archive at Nabble.com. > > ------------------------------------------------------------------------ -- > ---- > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.itextpdf.com/book/ > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ > You can also search the keywords list: > http://1t3xt.info/tutorials/keywords/ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.829 / Virus Database: 271.1.1/2913 - Release Date: 06/08/10 > 23:35:00 ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/