Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8526193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:12:11+00:00 2026-06-11T08:12:11+00:00

I met this message of error while trying to save an image which has

  • 0

I met this message of error while trying to save an image which has been generating using html2canvas.

So I wrote this code :

<div id"mycanvas">
    <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
    <div id="container2" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
    <div id="container3" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div>

 </page> 


<script type="text/javascript">
var canvas = document.getElementById("mycanvas");
var img    = canvas.toDataURL("image/png");
document.write('<img src="'+img+'"/>');
    </script>   

Even If the image rendered is in the cache and good generated using html2canvas I don’t know how to save it.

This code don’t seems to be wrong but it displays to me this message of error.

So I’m a bit lost.

Here are the errors messages:

Uncaught TypeError: Cannot call method 'toDataURL' of null export-graphic-stat_employee.php:241
html2canvas: Preload starts: finding background-images Core.js:18
html2canvas: Preload: Finding images Core.js:18
html2canvas: Preload: Done. Core.js:18
html2canvas: start: images: 0 / 0 (failed: 0) Core.js:18
Finished loading images: # 0 (failed: 0) Core.js:18
html2canvas: Renderer: Canvas renderer done - returning canvas obj Core.js:18
Screenshot created in 167 ms<br /> Core.js:18

Receive all my utmost respect.

Kind regards.

S.P.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:12:13+00:00Added an answer on June 11, 2026 at 8:12 am

    You’re missing an equals sign here;

    <div id"mycanvas">
    

    …which means your…

    document.getElementById("mycanvas");
    

    will return null.

    Calling null.toDataURL("image/png"); is what is giving you the error message.

    EDIT: If you want to actually use toDataURL, that method only works on an actual canvas element and you’re trying to use it on a div. Instead, remove the id on the div and either add;

    <canvas id="mycanvas" width="400" height="400" > </canvas>
    

    or use the actual canvas id from the canvas generated by HTML2Canvas to have an actual canvas element to work with.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone met this error? Right now i am trying to do switch from
Has anyone met this problem ? I've checked the output of phpinfo() ,and see
i got this error: Compiler Error Message: CS1001: Identifier expected from this set of
I've been trying to create a Metro based client for a WCF service, using
I'm new in iOS development, and met this library linking problem in last few
guys I know this question is very basic but I've met in few publications
I met a problem which is very strange, my company uses Visual Source Safe
I met a problem when trying @Singleton of Guice: import com.google.inject.Singleton; @Singleton public class
I have been using TortoiseSVN for a 2-3 months to control my subversion. Today
This is Rails 2.3.8, I am using Bundler 1.0.21 and RubyGems 1.6.2 on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.