Hi,
html2canvas :options.onrendered is deprecated. Bug,I found your code not update, so when call pdf.addHtml() funcion there will be an error occured.
Got a similar problem i made a website but didnt Uploaded it. When i try to make a screenshot the console said:"
html2canvas 1.0.0-alpha.9
html2canvas.js:3359:9
0ms html2canvas: onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value
html2canvas.js:2687:17
114ms html2canvas: Document cloned, using computed rendering
html2canvas.js:2673:17
115ms html2canvas: Starting node parsing
html2canvas.js:2673:17
162ms html2canvas: Finished parsing node tree
html2canvas.js:2673:17
168ms html2canvas: Finished loading 3 images
Array [ img, img, img ]
html2canvas.js:2673:17
171ms html2canvas: Starting renderer
html2canvas.js:2673:17
173ms html2canvas: Canvas renderer initialized (1904x522 at 8,293) with scale 1
html2canvas.js:2673:17
187ms html2canvas: Render completed
html2canvas.js:2673:17
html2canvas 1.0.0-alpha.9
html2canvas.js:3359:9
0ms html2canvas: onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value
html2canvas.js:2687:17
161ms html2canvas: Document cloned, using computed rendering
html2canvas.js:2673:17
162ms html2canvas: Starting node parsing
html2canvas.js:2673:17
317ms html2canvas: Finished parsing node tree
html2canvas.js:2673:17
350ms html2canvas: Finished loading 3 images
Array [ img, img, img ]
html2canvas.js:2673:17
385ms html2canvas: Starting renderer
html2canvas.js:2673:17
391ms html2canvas: Canvas renderer initialized (1887x522 at 8,291.1333312988281) with scale 1
html2canvas.js:2673:17
447ms html2canvas: Render completed
but in jsfiddle everything works fine https://jsfiddle.net/699j050r/740/
is there any news about this issue, i got the same problem, ty.
Well you have to rewrite it to use a Promise
yet this bug is not resolved. I have updated html2canvas
html2canvas returns a Promise with the canvas as the value
the problem seems to be with addHTML not keeping up with html2canvas updates
Is this already solved @ClaytonWang ?
options.onrendered is deprecated
This means html2canvas doesn't use onrendered anymore, therefore this is not a bug. What you have to do now in order to execute code after rendering the canvas is the following:
html2canvas(document.querySelector("#myDiv")).then(canvas => {
document.body.appendChild(canvas);
saveImage(); //or whatever you want to execute
});
We are closing this issue, because we will not support any longer fromHTML and addHTML.
Explaination:
We are working on a new html2pdf plugin, which will be based on html2canvas and our context2d plugin. This should lead to more reliable results for your projects. And it will give us the time to focus on the core functionality of pdf-generation because we will not use our energy for writing/supporting/extending 2 html plugins. If you still want to use addHTML or fromHTML you can still use jsPDF 1.4.1.
Best Regards
@arasabbasi when do you think your new plugin will be ready?
See #1176
Most helpful comment
This means html2canvas doesn't use onrendered anymore, therefore this is not a bug. What you have to do now in order to execute code after rendering the canvas is the following: