title: Is there any way to speed up PDF download on mobile browsers using a combination of JSPDF and html2canvas?
body: <p>I am creating a PDF from a DOM file using a combination of html2canvas and jspdf to convert a section of the DOM into an image and then add it to the respective PDF file created.</p>
  
  <p>This is working fine on the desktop browser but is tremendously slow on the mobile browser. </p>
  
  <p>You can test out the issue on a mobile browser by going to the link mentioned below and then selecting on any of the templates, followed by clicking on the download option.</p>
  
  <p><a href="https://countenance-proto.herokuapp.com/resumevariation" rel="nofollow noreferrer">https://countenance-proto.herokuapp.com/resumevariation</a></p>
  
  <p>Here is the functional code for the respective canvas to pdf conversion.</p>
  
  <pre><code> printTemplate = () =&gt; {
          const input = document.getElementById("main-document");
  
          html2canvas(input, {
              scale: 2
          })
              .then((canvas) =&gt; {
                  const imgData = canvas.toDataURL('image/png');
                  const pdf = new jsPDF("p", "mm", "a4", true);
  
                  let width = pdf.internal.pageSize.getWidth();
                  let height = pdf.internal.pageSize.getHeight();
  
                  pdf.addImage(imgData, 'PNG', 0, 0, width, height, '', 'FAST');
                  pdf.save("countenance-resume.pdf");
              });
  
      }
  </code></pre>
  
  <p>I expect it to be at par with the time it takes for the pdf to download on desktop, if not less.</p>