title: How to reduce image quality in Html2Canvas
body: <p>I want to <strong>reduce image quality</strong> before exporting everything to PDF. If document span more than 3 to 6 pages in PDF, its file size increases heavily(<strong>getting very high quality image</strong>), <strong>~40 MB</strong>. I want reduced file size, something like compressed file. Is there any property that is required to be set in Html2Cavans for compressed file size?</p>
  
  <pre><code>html2canvas(form, {
  imageTimeout: 2000,
  removeContainer: true,
  onrendered: function (canvas) {
      var img = canvas.toDataURL("image/png");
      var doc = new jsPDF({
          unit: 'pt',
          format: 'a4',
      });
  
      // pageHeight= doc.internal.pageSize.height;
      var image = new Image();
      image = Canvas2Image.convertToPNG(canvas);
      doc.addImage(img, 'PNG', 12, 15);
      var corte = (vm.a4[1] * 1.33333) - 30;
      var croppingYPosition = corte;
      var count = (image.height) / corte;
      for (var i = 1; i &lt; count; i++) {
          doc.addPage();
          var sourceX = 0;
          var sourceY = croppingYPosition;
          var sourceWidth = image.width;
          var sourceHeight = corte;
          var destWidth = sourceWidth;
          var destHeight = sourceHeight;
          var destX = 0;
          var destY = 0;
          var canvas1 = canvas;
          canvas1.setAttribute('height', corte * i);
          canvas1.setAttribute('width', destWidth);
          var ctx = canvas1.getContext("2d");
          ctx.drawImage(image, sourceX,
                               sourceY,
                               sourceWidth,
                               sourceHeight,
                               destX,
                               destY,
                               destWidth,
                               destHeight);
          var image2 = new Image();
          image2 = Canvas2Image.convertToPNG(canvas1);
          var image2Data = image2.src;
          doc.addImage(image2Data, 'PNG', 12, 15);
          croppingYPosition += destHeight;
      }
      doc.save('firstPDF.pdf');
      $('.pdfTemplates').css('width', '100%');
  }
  </code></pre>
  
  <p>});</p>