-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
html2canvas only showing viewport. not printing complete DIV #1158
Comments
This is an error in html2canvas, and there is a pull request open to fix the problem on html2canvas repository: You can use the branch of the repository with npm: |
@lennu so there is not option to do this? if i use simple html to pdf conversion without using html2canvas then there is problem of autosplitting in which it stretched out the pdf and blurry pdf. Can you recomment what should i use other than the jspdf library to make the pdf? from which i can have multiple configuration. |
I haven't really found a great solution to do webpage to pdf conversion on the frontend. The combination of jsPDF and html2canvas is a good one, if someone can get it working. This eKoopmans, who has made the pull request to fix html2canvas is working on a solution that uses html2canvas and jspdf: |
Hi there! Yes, I've made html2pdf, which uses html2canvas + jsPDF to create PDFs from HTML. It should do what you want - feel free to open an issue over there if it gives you any trouble! |
@eKoopmans sorry for the late reply. I want to try html2pdf is this library gives autobreak to div to be printed on new page? can you plz guide me that where i can see the examples. |
Hi @adeel3612, you can find a description for using page-breaks here. Right now, to add page-breaks you need to add an empty In the future I plan to add a feature to specify page-breaks on existing elements, without having to add divs, but that's not available yet. If you need that sort of functionality, you could do something like: var el = document.getElementById('element-after-page-break');
var pageBreak = document.createElement('div');
pageBreak.className = 'html2pdf__page-break';
el.parentElement.insertBefore(pageBreak, el); |
@eKoopmans Thanks i am implementing this in my application. just a last thing i want to ask. When i used jspdf along with html2canvas i have a problem. It is kinda weird i am seeing this behaviour but on mac safari it gives totally black pdf and in the firefox of safari it changes the white spaces to the black and else div is print out in the pdf. Any help your library can provide me on this regard? P.S : i really like this idea to add the page breaks and i can split the page where ever i want. |
Hi @adeel3612, I'll respond to your open issue eKoopmans/html2pdf.js#10, it looks like the same question you've asked here. |
@eKoopmans Hi! actually that problem is solved now about the black screen in mac and auto but i got another thing which is not showing the graph i think i should close the question here because your library gives me all the answers. |
Great, sounds good! |
I m using html2canvas along with jsPDF to create a pdf. Unfortunately documentation of both is not enough and i am banging my head. I want to create a pdf having multipe div in a single huge DIV. what i mean, is i have many divs inside a div which i want to print.
Problem:
PDF is only generating the viewport screenshot. i want to ask if there is an possible solution?
this is my function call
`function generate_pdf(){
var quotes = document.getElementById('blank_summary_table');
}`
The text was updated successfully, but these errors were encountered: