that's not enough memory. Bill Ensley Bear Printing
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of yuanjk > Sent: Wednesday, August 10, 2005 6:32 AM > To: itext-questions@lists.sourceforge.net > Subject: [iText-questions] Why out of memory > > > I had wrote a servlet with PdfContentByte to create a 1000 page pdf > dynamiclly . but out of memory , Then I wrote two test programe with > 10000 circle , > the same resutl, out of memory.Can anybody help me, > > Thanks. > > PS; java -Xms64m -Xmx64m > > ------------------------test 1 ---------------- > /* > * $Id: Text.java,v 1.4 2005/05/09 11:52:50 blowagie Exp $ > * $Name: $ > * > * This code is part of the 'iText Tutorial'. > * You can find the complete tutorial at the following address: > * http://itextdocs.lowagie.com/tutorial/ > * > * This code is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > * > * itext-questions@lists.sourceforge.net > */ > package itexttest; > > import java.io.FileOutputStream; > import java.io.IOException; > import java.util.Iterator; > > import com.lowagie.text.Document; > import com.lowagie.text.DocumentException; > import com.lowagie.text.pdf.BaseFont; > import com.lowagie.text.pdf.PdfContentByte; > import com.lowagie.text.pdf.PdfWriter; > import com.lowagie.text.FontFactory; > /** > * Adding text at an absolute position. > */ > public class TestMemo { > /** > * Adding text at absolute positions. > * @param args no arguments needed > */ > public static void main(String[] args) { > > System.out.println("Text at absolute positions"); > > // step 1: creation of a document-object > Document document = new Document(); > > try { > > // step 2: creation of the writer > PdfWriter writer = PdfWriter.getInstance(document, > new FileOutputStream("G:/JBuilder Project/iTextTest/outputPdf/text.pdf")); > > // step 3: we open the document > document.open(); > > // step 4: we grab the ContentByte and do some stuff with it > PdfContentByte cb = writer.getDirectContent(); > > // first we draw some lines to be able to visualize > the text alignment functions > cb.setLineWidth(0f); > cb.moveTo(250, 500); > cb.lineTo(250, 800); > cb.moveTo(50, 700); > cb.lineTo(400, 700); > cb.moveTo(50, 650); > cb.lineTo(400, 650); > cb.moveTo(50, 600); > cb.lineTo(400, 600); > cb.stroke(); > > // we tell the ContentByte we're ready to draw text > cb.beginText(); > > BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, > BaseFont.CP1252, BaseFont.NOT_EMBEDDED); > > for(int page=1;page<=100000;page++){ > cb.setFontAndSize(bf, 12); > String text = "Sample text for alignment"; > // we show some text starting on some absolute > position with a given alignment > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > text + " Center", 250, 700, 0); > cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, text > + " Right", 250, 650, 0); > cb.showTextAligned(PdfContentByte.ALIGN_LEFT, text > + " Left", 250, 600, 0); > > // we draw some text on a certain position > cb.setTextMatrix(100, 400); > cb.showText("Text at position 100,400."); > > // we draw some rotated text on a certain position > cb.setTextMatrix(0, 1, -1, 0, 100, 300); > cb.showText("Text at position 100,300, rotated 90 > degrees."); > > // we draw some mirrored, rotated text on a certain position > cb.setTextMatrix(0, 1, 1, 0, 200, 200); > cb.showText("Text at position 200,200, mirrored and > rotated 90 degrees."); > > // we tell the contentByte, we've finished drawing text > cb.endText(); > } > } > catch(DocumentException de) { > System.err.println(de.getMessage()); > } > catch(IOException ioe) { > System.err.println(ioe.getMessage()); > } > > // step 5: we close the document > document.close(); > } > } > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions