spipu/html2pdf

.save() method does not give me a download prompt

Closed this issue · 1 comments

I have a leaflet map (panned and zoomed manually) and html generated by changing innerHTML content of an element, in my document. I want to generate pdf from this dynamic content. jsPDF library gives me a CORS error that it cannot access images on my hard drive.

html2pdf maybe generates something, because it shows some log output, but it does not save file. I also tried with version 0.9.3 as suggested on some page.

My code:
function toPDF () {
html2pdf()
.from(document.body)
.save();
}
This is called from onClick event of a button.

The debug output:
18655ef8647 0ms Starting document clone
html2canvas.js:5102 [Violation]Avoid using document.write().
e.toIFrame @ html2canvas.js:5102
(anónimo) @ html2canvas.js:7267
(anónimo) @ html2canvas.js:83
(anónimo) @ html2canvas.js:64
(anónimo) @ html2canvas.js:57
n @ html2canvas.js:53
oi @ html2canvas.js:7213
(anónimo) @ html2canvas.js:7208
(anónimo) @ worker.js:143
U @ es6-promise.js:408
F @ es6-promise.js:391
f @ es6-promise.js:125
html2pdf.bundle.min.js:2 [Violation]'click' handler took 284ms
[Violation]Forced reflow while executing JavaScript took 37ms
html2canvas.js:2377 18655ef8647 435ms Document cloned, using computed rendering
html2canvas.js:2377 18655ef8647 435ms Starting DOM parsing
html2canvas.js:2377 18655ef8647 466ms Added image file:///C:/Users/Tambet/Desktop/Adreces_Recursos/icons/marker-shadow.png
html2canvas.js:2377 18655ef8647 722ms Added image file:///C:/Users/Tambet/Desktop/Adreces_Recursos/icons/marker-icon-brown.png
html2canvas.js:2377 18655ef8647 732ms Added image file:///C:/Users/Tambet/Desktop/Adreces_Recursos/icons/marker-icon-red.png
html2canvas.js:2377 18655ef8647 970ms Added image data:image/svg+xml,%3Csvg%20aria-hidden%3D%22true%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%228%22%20viewBox%3D%220%200%2012%208%22%20class%3D%22leaflet-attribution-flag%22%20style%3D%22-webkit-writing-mode%3A%2
html2canvas.js:2377 18655ef8647 1208ms Starting renderer
html2canvas.js:2377 18655ef8647 1214ms Canvas renderer initialized (794x5502 at 0,0) with scale 1.25
html2canvas.js:2377 18655ef8647 1402ms Finished rendering

spipu commented

you are not on the good project, here it is a php project, not a JS project