vandeseer / easytable

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

Table always gets added to the last page #61

Closed matkg closed 4 years ago

matkg commented 4 years ago

The table gets always added to the last page in my implementation. Is there a way to add the copy of a table to each page? Would be handy to create footers or headers of a document.

val contentStream = PDPageContentStream(
            pdfDocument, pdfDocument.getPage(0),
            PDPageContentStream.AppendMode.APPEND, false, false
        )

        TableDrawer.builder()
            .table(table)
            .startY(yPos)
            .startX(tableRect.lowerLeftX)
            .contentStream(contentStream)
            .build()
            .draw(Supplier<PDDocument> { pdfDocument }, Supplier<PDPage> { PDPage(PDRectangle.A4) }, headerOffset)
vandeseer commented 4 years ago

That's possible, maybe have a look here:

Hope this helps!

Best, Stefan

matkg commented 4 years ago

Thanks thats exactly what i needed why isn't this the normal behaviour of the table drawer?

vandeseer commented 4 years ago

Actually it is! 😉

Have a look at the minimum working example which is also referenced from the README for instance.

You can simply call .draw() and that's it.