javascript - how to hide the divs in html2canvas -


hello using jspdf along html2canvas. have seen in add.html can hide divs. possible have ability in html2canvas.

i making pdf want divs of main div not printed in pdf.

this html2canvas code.

html2canvas(quotes, {     onrendered: function(canvas) {          //! make pdf         var pdf = new jspdf('p', 'pt', 'a4');         (var = 0; <= quotes.clientheight/980; i++) {             //! html2canvas stuff             var srcimg  = canvas;             var sx      = 0;             var sy      = 980*i; // start 980 pixels down every new page             var swidth  = 900;             var sheight = 980;             var dx      = 0;             var dy      = 0;             var dwidth  = 900;             var dheight = 980;              window.onepagecanvas = document.createelement("canvas");             onepagecanvas.setattribute('width', 900);             onepagecanvas.setattribute('height', 980);             var ctx = onepagecanvas.getcontext('2d');             // details on usage of function:             // https://developer.mozilla.org/en-us/docs/web/api/canvas_api/tutorial/using_images#slicing             ctx.drawimage(srcimg,sx,sy,swidth,sheight,dx,dy,dwidth,dheight);              // document.body.appendchild(canvas);             var canvasdataurl = onepagecanvas.todataurl("image/png", 1.0);              var width         = onepagecanvas.width;             var height        = onepagecanvas.clientheight;              //! if we're on other first page,             // add page             if (i > 0) {                 pdf.addpage(612, 791); //8.5" x 11" in pts (in*72)             }             //! declare we're working on page             pdf.setpage(i+1);             //! add content page!             pdf.addimage(canvasdataurl, 'png', 20, 40, (width*.62), (height*.62));          }         //! after loop finished running, save pdf.         pdf.save('test.pdf');     } }); 

any kind of appreciated. thankx in advance.

i solved searching more about html2canvas.

you need add

data-html2canvas-ignore="true" 

in html element hide div rendering.

like

<div class="anyclass" data-html2canvas-ignore="true">any data</div> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -