PdfWriter - unwanted page break after table
- From: Andrea Lombardoni <andrea (at) lombardoni.ch>
- Date: Tue, 31 Oct 2006 16:34:30 +0000 (UTC)
I am using itext-1.4.6.jar and I am experiencing the following problem.
When using the PdfWriter, after a table is split between two pages, an unwanted
page break occurs. The content resumes on the new page.
Am I doing something wrong or is this a bug?
This was reported also here:
http://thread.gmane.org/gmane.comp.java.lib.itext.general/22922/focus=22942
but without any definite answer.
The following is the example code:
/**
Class used to test iText output
*/
public class TestiText extends PdfPageEventHelper{
public final static String OUT_FILE_PDF = "out.pdf";
public final static String OUT_FILE_HTML = "out.html";
public final static String OUT_FILE_RTF = "out.rtf";
public static void main(String[] args){
try{
FileOutputStream pdfOut = new FileOutputStream(OUT_FILE_PDF);
FileOutputStream rtfOut = new FileOutputStream(OUT_FILE_RTF);
FileOutputStream htmlOut = new FileOutputStream(OUT_FILE_HTML);
Document doc = new Document(PageSize.A4);
PdfWriter pdfWriter = PdfWriter.getInstance(doc, pdfOut);
pdfWriter.setPageEvent(new TestiText());
RtfWriter rtfWriter = RtfWriter.getInstance(doc, rtfOut);
HtmlWriter htmlWriter = HtmlWriter.getInstance(doc, htmlOut);
doc.open();
for(int tc=0;tc<100;tc++){
Paragraph p = new Paragraph("test para");
doc.add(p);
Table t = new Table(2);
t.setTableFitsPage(false);
for(int rc=0;rc<30;rc++){
Cell c1 = new Cell("table: "+tc+" left row: "+rc);
Cell c2 = new Cell("table: "+tc+" right row: "+rc);
t.addCell(c1);
t.addCell(c2);
}
doc.add(t);
}
doc.close();
}catch(Exception e){
System.out.println("Exception e: "+e);
}
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions