0

I have used jspdf and html2canvas for downloading Multiple svg into pdf format.

It is working fine in Chrome/Edge but not in Internet explorer as it shows Promise is undefined.

$("#dwnlPdf").click(function () {
                
     downloadDocs();
         });
         var doc = new jsPDF('landscape');
         function downloadDocs() {
            var length = $(".classDivs").length / 2; // pdf splitting
            for (let i = 0; i < length; i++) {
                var chart = $('#div' + i)[0]; 
             html2canvas(chart).then(function (canvas) {
                    doc.addImage(canvas.toDataURL('image/png'), 'JPEG', 10, 10, 180, 150);
                    if (i < (length - 1)) {
                        doc.addPage();
                    }
     else if(i==length-1)
     {
     doc.save('pdfdocs.pdf'); 
     }

                });
            }
        }

The above is my main JavaScript code, if not this please suggest me other plugins paid versions as well, only thing is it must be client side.

Thanks in Advance.

karun
  • 66
  • 8

1 Answers1

0

By looking at the html2canvas code, the library happens to make use of the Promises feature which unfortunately is not being supported in any version of IE

http://caniuse.com/#search=promises

I made a test with the sample on the sites Below are working with Internet Explorer 11. So you can have a try and check whether it can solve your issue or not.

d3js/SVG Export demo

download svg

Other Reference:

DocRaptor

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • Thanks for the response, it really addresses my question. "download_svg" is not working in IE 11, I want my Html and Svg both to be download in IE using javascript which is not working. "d3js/SVG export demo" is for only svg. – karun Nov 20 '18 at 06:56
  • @ Karun, For HTML to PDF you can try to refer DocRaptor. I try to find for the JS library which convert both SVG and HTML to PDF but I find that most of the examples uses multiple JS libraries to fulfill this requirement. So I suggest you to check for using multiple libraries supported in IE 11 may help you to solve the issue. I did not get any single library that can convert both SVG and HTML to PDF. – Deepak-MSFT Nov 21 '18 at 06:23