You are in the mailing list as [EMAIL PROTECTED] but you are sending the mail from [EMAIL PROTECTED].
 
Best Regards,
Paulo Soares


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kurakula, Suneetha (HCF)
Sent: Thursday, August 26, 2004 1:41 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [iText-questions] problem with pdfwriter and PDFPTable

Hi All,

 

Thankyou very much Paulo for the response. I solved my problem using getTotalHeight().

 

I am already in mailing list.

 

-Suneetha

 

 

 

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent:
Thursday, August 26, 2004 7:41 AM
To: Kurakula, Suneetha (HCF); [EMAIL PROTECTED]
Subject: RE: [iText-questions] problem with pdfwriter and PDFPTable

 

You are mixing apples with oranges. If you are using fitPage() then you must place the table with Document.add(). If using writeSelectRows() the layout is completely your responsability and you'll use getRowHeight() and getTotalHeight() to know when to render the table and go to the next page.

If using Document.add() a very good option for big tables is setSkipFirstHeader().

 

(with all this posts maybe it's time for you to join the mailing list)

 

Best Regards,

Paulo Soares

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kurakula, Suneetha (HCF)
Sent:
Wednesday, August 25, 2004 4:53 PM
To: '[EMAIL PROTECTED]'
Subject: [iText-questions] problem with pdfwriter and PDFPTable

Hi All,

Let me give you brief desc

 

I am using  two classes

  1. PDFAllPDFGen which generates pdf of all schedules(nearly 25 schedules)  in application

  2. Sched1PDFgen which generates individual  pdf I,e for schedule1

 

In Sched1PDFgen  I've method   

public void writeSched1(PdfWriter writer, Document document, HttpServletRequest request,HttpServletResponse response)

which takes above params and is used by both classes.

 

This method is invoked from  

 public void generate(HttpServletRequest request, HttpServletResponse response) throws IOException,Exception  of Sched1PDFgen which writes to stream

 

 

In PDFAllPDFGen generate method I am calling

Methods by instantiating each class like

public void generate(HttpServletRequest request, HttpServletResponse response)

{

   //For Sched1

   Sched1PDFgen  sched1 = new Sched1PDFgen ();

  sched1. writeSched1(PdfWriter writer, Document document, HttpServletRequest request,HttpServletResponse response);

 document.newPage();

//For Sched2

   Sched2PDFgen  sched1 = new Sched2PDFgen ();

  Sched2. writeSched2(PdfWriter writer, Document document, HttpServletRequest request,HttpServletResponse response);

 

}

Now problem is in Sched1

 

I am using PdfPTable in for loop

 

PdfPTable ancExp_body_Table = getAncExpHeaderTable();

for(int i=0 ; i<anc_income.length ;i++ )

 {

                 

                 String acctNo = anc_income[i].accountNumber.toString();

                 String expClass ="";

                 if(!anc_income[i].expenseClassification.trim().equals("null") && anc_income[i].expenseClassification != null)

                                expClass = anc_income[i].expenseClassification;

                String amt = nf.format(anc_income[i].amount);

                cell = new PdfPCell(new Paragraph(acctNo,normalFont));

                ancExp_body_Table.addCell(cell);

                cell = new PdfPCell(new Paragraph(expClass,normalFont));

                ancExp_body_Table.addCell(cell);

                cell = new PdfPCell(new Paragraph(amt,normalFont));

                ancExp_body_Table.addCell(cell);

 

                if (!writer.fitsPage(ancExp_body_Table)) {

                                System.out.println("Inside 8 fitpage");

                                ancExp_body_Table.deleteLastRow();

                                i--;

                                if(ancExp_body_Table.size() >1)

                                {

                                                ancExp_body_Table.writeSelectedRows(0, -1, document.left(),  document.top()-38, cb);

                                }

                                System.out.println("Before");

                                document.newPage();

                                System.out.println("After");

                                ancExp_body_Table = getAncExpHeaderTable();

                                //ancExp_header_Table.writeSelectedRows(0, -1, document.left(),  document.top()-20, cb);

                }

 

 }

}

 ancExp_body_Table.writeSelectedRows(0, -1, document.left(),  document.top()-38, cb);

 

Now problem is when table doesn't fit in writer  it is checking for condition(marked in orange) and opening a new page  when method is called from Sched1PDfGen .But data is truncated when method is called from PDFAllPDFGen  writer  is not opening a new Page().

Can anyone please help me with this issue?

 

Thanks,

Suneetha

Reply via email to