0

I have an div container which contains a span tag inside id there is svg tag element and have to convert it to pdf. i have tried using html2canvas.js. i need to print the area with borders. please check with the jsfiddle link. once i converted to image and using jspdf library will convert to pdf SVg image is not rendering after using canvg library and html2canvas

https://jsfiddle.net/6pupxnca/5/

 jQuery(document).on('click','#getpdf',function(){
     //console.log("canvas");
    html2canvas(jQuery('#view-front'), 
    {
        background: '#fff',
        allowTaint: true,
        //console.log("adsfasdf");
      onrendered: function (canvas) {
        var a = document.createElement('a');
        // toDataURL defaults to png, so we need to request a jpeg, then convert for file download.
        a.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
        console.log(a.href);
        a.download = 'somefilename.png';
        a.click();
      }
    });
  });
Selvaraj
  • 1
  • 3
  • [Did you look at this?](https://stackoverflow.com/questions/26481645/how-to-use-html2canvas-and-jspdf-to-export-to-pdf-in-a-proper-and-simple-way) – James Oct 25 '17 at 14:49
  • download pdf link not working with chrome browser – Selvaraj Oct 25 '17 at 14:52

0 Answers0