Skip to content
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

log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas"); #1610

Closed
ClaytonWang opened this issue Jan 31, 2018 · 11 comments

Comments

@ClaytonWang
Copy link

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.

@jogncena
Copy link

jogncena commented Feb 7, 2018

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/

@labyed
Copy link

labyed commented Feb 26, 2018

is there any news about this issue, i got the same problem, ty.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 26, 2018

Well you have to rewrite it to use a Promise

@patilharshal16
Copy link

yet this bug is not resolved. I have updated html2canvas

@patilharshal16
Copy link

html2canvas returns a Promise with the canvas as the value

@galileomd
Copy link

the problem seems to be with addHTML not keeping up with html2canvas updates

@miigangls
Copy link

miigangls commented Mar 30, 2018

Is this already solved @ClaytonWang ?

@Bscheef
Copy link

Bscheef commented Apr 7, 2018

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
});

@Uzlopak
Copy link
Collaborator

Uzlopak commented Sep 6, 2018

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

@Uzlopak Uzlopak closed this as completed Sep 6, 2018
@burtontanner
Copy link

@arasabbasi when do you think your new plugin will be ready?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jan 13, 2019

See #1176

@parallax parallax locked and limited conversation to collaborators Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants