@@ -501,6 +501,45 @@ public void largeTableWithLayoutResultNothingTest03() throws IOException, Interr
501
501
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
502
502
}
503
503
504
+ @ Test
505
+ public void largeTableOnDifferentPages01 () throws IOException , InterruptedException {
506
+ String testName = "largeTableOnDifferentPages01.pdf" ;
507
+ String outFileName = destinationFolder + testName ;
508
+ String cmpFileName = sourceFolder + "cmp_" + testName ;
509
+
510
+ PdfDocument pdfDoc = new PdfDocument (new PdfWriter (outFileName ));
511
+ Document doc = new Document (pdfDoc , PageSize .A4 .rotate ());
512
+
513
+ float [] colWidths = new float []{200 , -1 , 20 , 40 };
514
+
515
+ Table table = new Table (UnitValue .createPointArray (colWidths ), true );
516
+ doc .add (table );
517
+
518
+ // change the second page's size
519
+ pdfDoc .setDefaultPageSize (PageSize .A3 .rotate ());
520
+
521
+ for (int i = 0 ; i < 25 ; i ++) {
522
+ table .addCell (new Cell ().add ("Cell" + (i *4 + 0 )));
523
+ table .addCell (new Cell ().add ("Cell" + (i *4 + 1 )));
524
+ table .addCell (new Cell ().add ("Cell" + (i *4 + 2 )));
525
+ table .addCell (new Cell ().add ("Cell" + (i *4 + 3 )));
526
+
527
+ table .flush ();
528
+
529
+ // change the third page's size
530
+ if (i == 20 ) {
531
+ pdfDoc .setDefaultPageSize (PageSize .A5 .rotate ());
532
+
533
+ }
534
+ }
535
+
536
+ table .complete ();
537
+
538
+ doc .close ();
539
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
540
+ }
541
+
542
+
504
543
@ Test
505
544
public void largeEmptyTableTest () throws IOException , InterruptedException {
506
545
String testName = "largeEmptyTableTest.pdf" ;
0 commit comments