vandeseer / easytable

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

There Seems To Be No Way of Creating a Multipage Table Starting On Existing Page #45

Closed snorhax closed 5 years ago

snorhax commented 5 years ago

According to your integration test, the way to draw a multipage table is:

/* builder details here */
.draw(() -> document, () -> new PDPage(PDRectangle.A4), 50f);

But this seems to call a new page for every section of the table. On the other hand, if I list an existing page, the table will just overwrite the same page. Would it be too hard to provide a function or class that takes two PDPage objects? The first would be the initial page the table starts in. The second would be a constructor for any table overflow (preferably, the new pages would be inserted in between existing pages if, for example, you wanted a table to be inserted in a document on page 2, with the document already containing 3 pages). For example:

/* builder details here */
.draw(() -> document, () -> existingPage, () -> new PDPage(PDRectangle.A4), 50f);
snorhax commented 5 years ago

Of course, in the meantime, I would've just overridden the RepeatedHeaderTableDrawer class myself while waiting for official patch, but as was mentioned in a prior issue ( #29 ), there's a lot of data hiding that stifles this.

vandeseer commented 5 years ago

Hi @snorhax, thanks for sharing your thoughts. You are right that there is a shortcoming here. It is also connected with https://github.com/vandeseer/easytable/issues/44, because if the issue you mentioned was resolved already that could be as well (at least partially).

The thing is: I do not have enough time right now to come up with a proper fix. Chances are rather low that I will implement this in the next two or three weeks. But I am always willing to accept pull requests ;) So please feel free to come up with a solution that fits your needs (for instance implementing the method with three parameters as proposed) and I will be happy to merge it.

If you have a bit more patience I will most likely implement a solution by my own. But that will take a bit (maybe in a month or so).

arunggh commented 5 years ago

Of course, in the meantime, I would've just overridden the RepeatedHeaderTableDrawer class myself while waiting for official patch, but as was mentioned in a prior issue ( #29 ), there's a lot of data hiding that stifles this.

If Possible can you please share your fix? Many thanks.

styssi commented 5 years ago

Added a Pull Request that fixes the issue for me https://github.com/vandeseer/easytable/pull/46/files

vandeseer commented 5 years ago

Thanks a lot for your pull request @styssi :+1: I will release a new version shortly containing this change.

vandeseer commented 5 years ago

Fix is included in v0.5.1