-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text sliced at botton of pdf #13
Comments
Hi @lidijarad, yes at the moment that's intended behaviour. All html2pdf is doing is converting the webpage into an image, and then slicing that image onto separate PDF pages. If your text (or any other component) straddles two pages, it will appear sliced. The only solution I can recommend right now is the page-breaks. You can add a |
@eKoopmans, thank you for the feedback. Because the content in the html is dynamic, it is very difficult to calculate when to insert the page break. I have experimented with a few different ways, (counting number of characters in a page, estimating number of lines) but I have not found an elegant solution. I will continue working on this. If I find a solution, I will post it here. Thank you again, please keep in touch if you make any changes with regards to this. |
Great, thanks. I have a few ideas, but it depends on your situation. I could probably make an auto-break system that would add a page break before any element that would span two pages (as long as the element itself wasn't taller than a page). If you have spans of text longer than a page it would have to be a different solution. |
Hi, I had a similar problem printing reports in a vertically long table. I solved my it by calculating the heights of the element before I added them, adding a page-break if it would exceed the page height. It's not the most elegant solution however as it leaves a bit of a white space at the bottom of the page. An A4 page is 595pt/842pt ( 793px/1122px. ) I hope this helps, would be interested to hear the solution you choose to go with. |
Thanks @ABobbyT, yeah that's basically what I was thinking for an "auto-break" system, but I could work it into the internal guts of html2pdf. |
I'm guessing the auto-break is not there yet? It's actually the only thing I've actually found missing. Otherwise great job! |
Yes, you're right @MythThrazz! Haven't had much time to work on this project lately, unfortunately. I'm hoping to have an update soon! |
@ABobbyT @eKoopmans >>I solved my it by calculating the heights of the element before I added them s to 'echo' from a PHP loop and want to add page-break so that it does not break the text.
Please advise. Thanks |
Hi , i am too facing same probs in angular6. If any got solution means pls let me know, another probs is images not rendered from api. |
lilidijard I have the same problem did you come up with any solutions |
@eKoopmans @lidijarad did you find any solution? |
Hello @khateeburrehman @Greensahil, I never resolved this, I'm sorry. |
Hi all, see #153 for an update to page-breaks that will be merged in soon. |
hi, @lidijarad did you use any other library/3rd party. how you overcome that problem. |
Hi, closing as resolved by the v0.9.1 page-break features. |
Hi Guys, i am using the same version mentioned above i.e. 'v0.9.1' but still facing this issue of page break. |
Can you please check this pagebreak: { mode: 'avoid-all'}, i have tested in multi page pdf consisting of 10+ pages. it works fine for me |
Using mode : avoid-all as well doesnt work for me.. there is still text sliced at bottom |
@eKoopmans i am using this library and facing issue of large size client doesn't wants to compromise with the quality and they want to send the pdf over the mail. |
Hello @eKoopmans,
thank you again for such a great tool. I was wondering if you you or anyone has encountered this problem. I am using html2pdf lib to produce a PDF where the html is dynamic and changing. I have tried adjusting the margins but for some cases, when the text within the html is long and needs to go onto the next page, the text on the last line is sliced. Here is an example of what I mean: Is it possible that this might be due to the docHeight of the canvas as mentioned in #6?
This is how I am producing the pdf:
The text was updated successfully, but these errors were encountered: