vandeseer / easytable

Small table drawing library built upon Apache PDFBox
MIT License
246 stars 94 forks source link

Extra rows doesn't create next page #90

Closed stanleyfl88 closed 4 years ago

stanleyfl88 commented 4 years ago

Followed example from https://github.com/vandeseer/easytable/blob/master/src/test/java/org/vandeseer/MinimumWorkingExample.java

Added 30-40 more rows with height=4f, which suppose to have 2 pages of PDF. But extra rows doesn't create next page, only 1 page available.

vandeseer commented 4 years ago

This is already answered here; Also see this code.

AppLoidx commented 4 years ago

Some mention. Extra page will not be rendered if you use example from README:

RepeatedHeaderTableDrawer.builder()
    .table(createTable())
    .startX(50)
    .startY(100F)
    .endY(50F) // <-- If the table is bigger, a new page is started
    .build()

But if you call draw like this (example provided by author above):

        TableDrawer.builder()
                .table(createTable())
                .startX(50)
                .startY(100F)
                .endY(50F) // note: if not set, table is drawn over the end of the page
                .build()
                .draw(() -> document, () -> new PDPage(PDRectangle.A4), 50f);

it would work or I do something wrong in my code 😅