question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problem implementing html2canvas

See original GitHub issue

I have made the simplest of scripts to try out html2canvas, but can’t get it working. After consulting the web and these forums for hours, I have no other choice but bother you with this. This is my php file:

<?php
echo '<! DOCTYPE html>';
echo '<html>';
echo '<head>';

echo '<title>TESTIT</title>';
echo '<script type="text/javascript" src="jquery-1.8.0.min.js"></script>';
echo '<script type="text/javascript" src="html2canvas.js"></script>';
echo '<script type="text/javascript" src="jquery.plugin.html2canvas.js"></script>';

?>

<script type="text/javascript">

$('body').html2canvas(); 
var queue = html2canvas.Parse();  
var canvas = html2canvas.Renderer(queue,{elements:{length:1}}); 
var img = canvas.toDataURL();
window.open(img);

</script>


<?php

echo '</head>';

echo '<body>';

echo '<h1>THIS IS GREAT</h1>';
echo 'This is a test';

echo '</body>'; 
echo '</html>';

?>

In Firebug console I get : TypeError: html2canvas.Parse is not a function What am I doing wrong? YB

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
niklasvhcommented, Nov 7, 2012

To render an element with html2canvas, simply call: html2canvas( [ element ], options);

To access the created canvas, provide the onrendered event in the options which returns the canvas element as the first argument, as such:

html2canvas( [ document.body ], {
    onrendered: function( canvas ) {
        /* canvas is the actual canvas element, 
           to append it to the page call for example 
           document.body.appendChild( canvas );
        */
        }
});
0reactions
brcontainercommented, Oct 7, 2014

Hi @singhamit0002 Welcome!

Your question sounds like a difficulty and its “NOT A BUG” in “html2canvas” therefore the right time to make this sort of question is spot on: http://stackoverflow.com/questions/tagged/html2canvas (as explained in the “html2canvas” documentation in link named “Questions”)

Good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem generating image using html2canvas #35 - GitHub
Hello eveyone. I have a problem with the generation of image of jsGantt Using the instructions: var wg = Ext.get("GanttChartDIVchartTableh") ...
Read more >
html2canvas not working at all - Stack Overflow
Here is the code which isn't working. Basically I'm allowing the user to edit some text in the div and then display its...
Read more >
html2pdf.js | Client-side HTML-to-PDF rendering using pure JS.
Known issues. Rendering: The rendering engine html2canvas isn't perfect (though it's pretty good!). If html2canvas isn't rendering your content correctly, ...
Read more >
Export React components as images using html2canvas
Learn how to use html2canvas to export React components as images. This can be helpful for exporting multiple images from a page.
Read more >
Options - html2canvas
Name Default Description logging true Enable logging for debug purposes width Element width The width of the canvas height Element height The height of the canvas...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found