What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

Problem with HTML2Canvas

MalS

New member
I am attempting to use HTML2Canvas to create a canvas of an element on a webpage that is a container DIV with an image used as the page backgound with overlays of text elements and tables. Renders perfectly in HTML. When I check my code with a debugger the captured element shows the first child to be be the IMG and the last child the table which is correct. My HTML2Canvas creates a captured image on a popup window but the background image is missing from the capture.. only the text type of objects are in the displayed capture. The operative code is as follows: The imageDataURL is then the argmument of a src = statement to write to the popup. Any help is appreciated. BTW.. if I make my capture object only the image element the popup is blank so for whatever reason, the image is not rendering or whatever.
html2canvas(elementToCapture, {
width: elementToCapture.scrollWidth,
height: 1.2*elementToCapture.scrollHeight,useCORS: true }).then(function(canvas) {
imageDataUrl = canvas.toDataURL('imgage/png');
openImagePopup(imageDataUrl);
 
Top