simonbengtsson / jsPDF-AutoTable

jsPDF plugin for generating PDF tables with javascript
https://simonbengtsson.github.io/jsPDF-AutoTable/
MIT License
2.33k stars 624 forks source link

Overflow: 'linebreak' for continuing on new page? #79

Closed mthomas-io closed 9 years ago

mthomas-io commented 9 years ago

Hi Simon,

First of all, thanks for this great jspdf addition!

I'm using your autotable plugin in my project and so far it worked out very well. But now I encountered a problem when using long tables with long texts. My table is set to 'linebreak' overflow and this works for all cells, except the ones in the bottom row. The cells in the bottom row ellipsize the last line of the content, instead of linebreaking it and continuing on a new page. The new page starts with the next row. Is it possible to have a row continue on the next page in case the content does not fit anymore and if so, how would one configure this or is there any workaround you know of?

screenshot 2015-10-19 09 28 30

simonbengtsson commented 9 years ago

I have had issues with this and for some edge cases I decided to ellipses the content of the last row for now. The reason mainly being that the other solutions I came up with triggered other bugs. That said the edge cases I'm describing are for example when a row spans more than one page height. That doesn't seem to be the case for you however? Could you post (preferably) a codepen or some code and data that I can replicate this with?

mthomas-io commented 9 years ago

http://codepen.io/voxellotl/pen/bVYZLJ

PS: I noticed that in this pen the content of the second pages' bottom row causes a third page to be created without any content. So it is aware of the content not fitting on the original page.

simonbengtsson commented 9 years ago

Thanks! Thats a clear bug and something I thought was fixed. I will look into this as soon as possible.

emiller12 commented 9 years ago

Hi Simon,

I have started seeing this exact same bug in my project today. I have a large chunk of text in a cell (with overflow = linebreak) at the bottom of a page. There is also now a whole extra blank page at the bottom of my file (below the two pages shown in this screenshot).

pdftablebug

emiller12 commented 9 years ago

I have been working on a fix for this, emiller12/jsPDF-AutoTable@1013f066d608e50eb8282ed53c58f54f4e6be530

I have managed to solve the problem of the extra page with no content getting added after a table.

I am now working on a way to continue showing left over text on the next page (instead of ellipsizing) as voxellotl suggested in the first post.

simonbengtsson commented 9 years ago

I kind of fixed this now in 2.0.13. Now it should only be issues when one cell height is bigger than page height. The codepen posted above now works. I will consider it a feature request to create the beahvior of splitting one cell in multiple pages if it doesn't fit on the first, but I don't have any timeplan when to add it. If you @emiller12 want to look into it, feel free!

EDIT: The lib now splits rows to multiple pages when necessary.

scott-census commented 7 years ago

I too like autotable, but even though this is working correctly, it seems, I want another option, which is to defer the row to the next page. Most of my rows have a comment field that is from 3 to 10 lines. Rather than have the comment split across a page, I'd like to leave a bit of space on the first page and have the whole row appear on the second. I am planning to look into adding that as an option.

I also have a drawRow function that looks for a special tag and inserts a full-width row with group header text. That works fine, except when the row that triggers the header has already been split across pages. Hopefully this option would make that work correctly too.

simonbengtsson commented 7 years ago

There is a avoidRowSplit option implemented in version 3.0 which will probably be exactly what you are looking for. Version 3.0 is long overdue. The only thing left to decide is how the hooks should work. I think I have something I'm happy with, but still some hours left I need to spend on it some day.

scott-census commented 7 years ago

Excellent! Sounds exactly like what I am looking for.


Scott Gilkeson, Contractor, Dissemination and Internet Services Branch, Demographic Surveys Division, U.S. Census Bureau

Office 301.763.8703 scott.gilkeson@census.gov

census.govhttp://www.census.gov/ Connect with us on Social Mediahttp://www.census.gov/about/contact-us/social_media.html


From: Simon Bengtsson notifications@github.com Sent: Monday, May 15, 2017 1:47:21 PM To: simonbengtsson/jsPDF-AutoTable Cc: Scott Gilkeson (CENSUS/DSD CTR); Comment Subject: Re: [simonbengtsson/jsPDF-AutoTable] Overflow: 'linebreak' for continuing on new page? (#79)

There is a avoidRowSplit option implemented in version 3.0 which will probably be exactly what you are looking for. Version 3.0 is long overdue. The only thing left to decide is how the hooks should work. I think I have something I'm happy with, but still some hours left I need to spend on it some day.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/simonbengtsson/jsPDF-AutoTable/issues/79#issuecomment-301550309, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ASZJ5BXcztOduy9Imi4HUgCZM1rQ4NwQks5r6I-pgaJpZM4GRJDF.

scott-census commented 7 years ago

I hate to bug you, but any thoughts on when a Version 3.0 might be available? Is there anything I can do to help?

davidhockey22 commented 7 years ago

I too would really appreciate the avoidRowSplit option. Any timeline for this?