Thanks Sascha, That was part of it, the other part was my template PDF wasn't optimized, I didn't even look at the size of the bugger. It was 1.8mb(sheesh). I cut it down to 20k I've got quite a few form fields. It works like a champ now. akin to not checking if the computer is plugged in maybe this will be a good reminder to somebody at least. I feel foolish.
thanks Josh Sascha Fuchs wrote: > > Hello > > It a java setting (your java max heap is too low for handling big pdf's) > >>From command line you can adjust with command like java -Xmx200m ... (200MB heap). > > Better: There is a java config setting for default max heap (I can't > remember from ff -> search for java reference) > > Regards, > Sascha Fuchs > > -----Ursprüngliche Nachricht----- > Von: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Im Auftrag von > InJesus > Gesendet: Freitag, 11. Mai 2007 11:53 > An: [email protected] > Betreff: [iText-questions] Heap out of memory / PdfSmartCopy() > > > Hi, > Per Bruno's > http://www.nabble.com/PdfStamper-vs-PdfCopy-tf3685313.html#a10301433 > advice > > I used PdfSmartCopy following his example and after about 60 pages it > throws > a Java Heap out of memory. I'm trying to do this for potentiall 20 > thousand, > so just increasing my memory I don't think is going to be an option. Is > there an alternative method that's not goign to kill my server's memory? > > spefically this is what I'm doing > > PdfReader reader; > ByteArrayOutputStream baos; > PdfStamper stamper; > AcroFields form; > Document document = new Document(); > try { > PdfSmartCopy copy = new PdfSmartCopy(document, new > FileOutputStream("EIDForms.pdf")); > document.open(); > for (int i = 0; i < values.length; i++) { > // set fields > reader = new PdfReader("EIDFormTemplate.pdf"); > baos = new ByteArrayOutputStream(); > stamper = new PdfStamper(reader, baos); > form = stamper.getAcroFields(); > form.setExtraMargin(0, 1); > for (int j = 0; j < keys.length; j++) { > form.setField(keys[j], values[i][j]); > } > stamper.setFormFlattening(true); > stamper.close(); > // add page > reader = new PdfReader(baos.toByteArray()); > copy.addPage(copy.getImportedPage(reader, 1)); > } > } catch (DocumentException de) { > System.err.println(de.getMessage()); > } catch (IOException ioe) { > System.err.println(ioe.getMessage()); > } > document.close(); > -- > View this message in context: > http://www.nabble.com/Heap-out-of-memory---PdfSmartCopy%28%29-tf3726501.html#a10428999 > Sent from the iText - General mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > > -- View this message in context: http://www.nabble.com/Heap-out-of-memory---PdfSmartCopy%28%29-tf3726501.html#a10431474 Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
