Hello

I have a trouble about PDF doc creation using PdfPTable object.
Please give me adviece.

[Summary]
The last text line of a Paragraph in the last PdfPRow in the each page 
can be printed in twice by page split.

[Sample]
I show a sample code:
--------------------
   public static void main(String[] args) throws Exception {
       Document document = new Document();
       PdfWriter.getInstance(document, new 
FileOutputStream("textPrintedInTwiceByPdfProwSplit_Issue.pdf"));
       document.open();

       int colmunNum = 3;
       PdfPTable table = new PdfPTable(colmunNum);
       Font font = new Font();
       font.setSize(7);

       PdfPCell cell = new PdfPCell(new Paragraph("header", font));
       cell.setColspan(colmunNum);
       table.addCell(cell);

       int maxCells = colmunNum * 1;
       for (int i = 0; i < maxCells; i++) {

           StringBuffer sb = new StringBuffer();
           int maxLine = 220;
           int row = i / 3;
           int col = i % 3;
           for (int lineNum = 0; lineNum < maxLine; lineNum++) {
               sb.append("(row, col)=(" + row + ", " + col + 
"):lineNum=" + lineNum);
               sb.append("\n");
           }
           table.addCell(new Paragraph(sb.toString(), font));
       }
       table.setSplitRows(true);
       table.setSplitLate(false); // split option
       document.add(table);
                 document.close();
   }
--------------------

[Result]
"lineNum=107" text was printed on the page 1 and 2. It's a problem.
"lineNum=205" text was printed on the page not 3 but only 2. It's OK.

[Enviroments]
iText version : 2.1.7 and SVN trunk head (Revision:4103)
JRE : 1.6.0_05

[Others]
When I changed PdfPTable#setSplitLate(true),  the result was no problems.
But, I changed PdfPTable#setSplitLate(true) and font size 7 to 6, it's 
NG again.
It seems the problem has something to do with font size.

I think that PdfPRow#split or ColumnText#writeSelectedRows need to 
modify...

Best Regards, Okada

-----------------------------
Tatsuhiro Okada

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/

Reply via email to