Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html2canvas converting only visible area of window

i am using html2canvas plugin for this.

i am currently using this code.

 html2canvas($("#chartDiv"), {                              
  onrendered: function (canvas) {

   var win = window.open();
   win.document.write("<br><img src='" + canvas.toDataURL() + "'/>");
   win.print(); 
  }
});

when i convert the div to canvas, only the visible part of the window is turned into canvas.

i need to find a solution where i can print the div into many pages if the div is over the size the window. ?

thank in advance

this is my current output

like image 694
Hudhaifa Yoosuf Avatar asked Nov 09 '22 06:11

Hudhaifa Yoosuf


1 Answers

Looks like the only option you have is to modify the page to look the way you want the image to look before rendering.

I was facing the same problem when used html2canvas, and this is one of the reasons, why I write the methods that draw what I want to the canvas myself now.

Maybe have a look at this

like image 173
impiouz Avatar answered Nov 14 '22 22:11

impiouz