Thanks paulo I implemented with the link which you gave . It is working great. I really enjoyed by seeing the example as I got structed for nearly 2 days with that problem. now, I have a small issue. The scenario for my application is to load 2 different data in 2 tables. when , I implemented the logic , it was loading the data only related to first table, data was not getting loaded in the sencond table. when I checked with the debugging tool with the break points, it looks fine as it was getting all the data from the data base and also adding to the table and then finally to the document . But when I checked in the pdf, i coudlnt see the data related to the 2nd table. Thanks in advance. with regards, Srini.
Paulo Soares wrote:
http://itextdocs.lowagie.com/tutorial/objects/tables/pdfptable/index.html#memory Paulo ----- Original Message ----- From: "Srinivasa Arava" <[EMAIL PROTECTED]> To: Sent: Monday, October 09, 2006 5:57 PM Subject: [iText-questions] Java heap error, out of memory Hi, I am trying to generate a pdf from java by using iText API. If no of records are less than 1000, I could load the data into the pdf and it is working fine. But if the no of records are huge (I tried with around 15,000 records) , I was getting an error saying that "Java heap error, out of memory" . I made changes to the JVM memory size to 1024MB . it was working fine, but we have a performance issue as these page will be accessed by multiple clients and and used very frequently. The approach followed: ----------------------- I am reading all the data and putting it in a PdfPTable and then finally attaching the table to the document. the code piece: ---------------- if (response instanceof HttpServletResponse) { HttpServletResponse res = (HttpServletResponse)response; //Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); //PdfWriter.getInstance(document, baos); //document.open(); // and directs a PDF-stream to a file Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("createPdfValidPayments.pdf")); //document.open(); if (validPaymentsListPdfWriter()) { //document.close(); res.setContentType("application/pdf"); res.setHeader("Cache-Control", "no-cache"); res.setContentLength(baos.size()); ServletOutputStream out = res.getOutputStream(); baos.writeTo(out); out.flush(); context.responseComplete(); } else { //addMessage("No matches found."); //document.close(); } } NOTE: ------ validPaymentsListPdfWriter() is the method where I am reading all the data from the database and storing writing it to the PdfPTable . public boolean validPaymentsListPdfWriter() { ReportsDAO dao = new ReportsDAO(); RowSet rowSet = dao.executegetValidPaymentReportList(); if (rowSet != null) { isListFound = true; document.setPageSize(PageSize.A4); // add Request information Font headerFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 9); Font contentFont = FontFactory.getFont(FontFactory.TIMES_ROMAN, 6); float[] cellwidths = new float[]{0.22f, 0.1f, 0.1f, 0.15f, 0.15f, 0.14f }; int tableWidthPercentage = 100; //add to table document.add(getTable(rowSet, cellwidths,tableWidthPercentage,headerFont,contentFont)); } //getTable is the method where I am reading and setting all the records in the table. Environment used: ------------- iText 1.4.4 Weblogic 9 is there any approch where i can split the data and store into the pdf instead of reading the whole bunch data and writing to pdf at once. any suggestions or help will be appreciated. Thannks, srini. -------------------------------------------------------------------------------- > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV -------------------------------------------------------------------------------- > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions


View this message in context: Re: Java heap error, out of memory
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to