vandeseer / easytable

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

Compression not working when TableDrawer.draw(Supplier<PDDocument>, Supplier<PDPage>, float ) is called #98

Closed sulabhk95 closed 4 years ago

sulabhk95 commented 4 years ago

You have hardcoded compress false in line try (final PDPageContentStream newPageContentStream = new PDPageContentStream(document, pageToDrawOn, APPEND, false)) {

sulabhk95 commented 4 years ago

Hi, this is very nice library. Added pull request https://github.com/vandeseer/easytable/pull/99 Right now added compress attribute for TableDrawer. You can suggest any other approach also.i need compression for my project, so i would appreciate if you can review at the earliest. Thanks :-)

vandeseer commented 4 years ago

Thanks for your pull request! I will have a look shortly.

Best, Stefan

vandeseer commented 4 years ago

I merged it and will create a new release soon.

sulabhk95 commented 4 years ago

Thanks. I also noticed one more thing. I was creating huge tables with ~100-200k rows. If i created 1 huge table and then draw it memory requirement was very high, 3-4 gb overhead in my this case. There would be so many Cell and Rows objects in memory. So i wrote a wrapper over your library that

  1. calculates the max rows that can be put in a page.
  2. client would then "add rows" in batches of size u got from 1. and write it to content stream This way Cell & row objects of each page would be eligible for GC. This way max heap usage was around 300~400 MB.

If you want we can discuss on adding such an interface here also.

vandeseer commented 4 years ago

Hey @sulabhk95,

sounds nice. Would you mind opening another issue where we can discuss and/or create a pull request (against develop). We can definitely have a look. I am always open for contributions.

Best, Stefan

vandeseer commented 4 years ago

Closing this issue now (resolved with release 0.7.1)