voilab / voilab-pdf-table

PdfKit wrapper that helps to draw informations in simple tables
MIT License
52 stars 26 forks source link

auto grow all columns? #16

Open yocontra opened 6 years ago

yocontra commented 6 years ago

is this possible? i've tried it by adding the fitcolumn plugin for each column but it ends up laying out really bad. i think this is a super common use case - i just want to render data in a table, i don't care how wide anything is because the width will vary depending on what i render. if i have one column that has super long values and one with some small values it would handle that nicely.

tafel commented 3 years ago

What is problematic here is that you need to know the width of all your cells first, then calculate a ratio to determine width for each column.

The goal of this lib is to provide a quick way to draw data in a table. Predefined widths is a lot more optimized than calculating by parsing everything.

If you find a decent way to do that, please create a new PR, so we can discuss that here and see what is possible.

yocontra commented 3 years ago

@tafel Luckily you can only fit so many rows on a page, and if you draw each page one at a time you could quite easily buffer a page worth of rows, compute the sizes, then render the page. Just a thought - if out of scope for this library feel free to close this issue.