addHtml function of a div does not render the div completely
Hi
I am trying to convert a html div content, which is in a modal dialog. I am using addHtml and the page does not render completely in the pdf document. Instead, I can see only partial content which I can see on the screen. The remaining content which is scrollable is not seen.
Any help how to display the entire div. Thanks in advance
Any help appreciated.
I don't know if we have the same problem but it does that to my d3 generated graph
I'm having the same issue, page with scrollbars does not rendered completely.
+1
Even I have the same issue and I am using html2canvas 0.5.0-alpha2. In the html2canvas, the following code seems to have the issue. Here, "node.ownerDocument.defaultView.innerHeight" seems to consider only the height of the node's viewport. So when there is a scrollable div, only the visible portion gets printed in the pdf.
return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight, index).then(function(canvas) { if (typeof(options.onrendered) === "function") { log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"); options.onrendered(canvas); } return canvas; });
Same for me, Only the part of the div visible in the current scroll view is being rendered into the pdf file. A few days ago though, i didn't run into this problem, which is a bit weird. I am serving my jspdf.js right from this repository http://mrrio.github.io/jsPDF/dist/jspdf.debug.js, so I was wondering, could this be some change that happened in the past few days?
OK, just realized something important that might be of use to anyone encountering this problem. I have a div that's larger in height than the screen height, this means that not all of it can be visible at a time. Now I realized that the problem is somehow related to the current scroll position on the page. Basically I found out that if the current scroll position is lower than the div, then you will have this rendering issue, but if it is higher up than the div, it renders perfectly. I am not sure I got this correct, this is just something I found a couple minutes ago, but it works for me now
@ilanle,
That sounds interesting. I think I have similar problem too..
Can some one post an example??? I still have the issue. Tried to implement this.
https://github.com/niklasvh/html2canvas/issues/461
has this fix been addressed?
Hi there,
There's now a html2pdf example which much better supports generating documents from HTML.
Get the latest master and try:
npm install
npm start
Then visit localhost:8000/examples/html2pdf/showcase.html
Hope this works well for you :)
Many thanks, James
localhost:8000/examples/html2pdf/showcase.html how can I open this it is local url