Download html and svg to pdf Client SIde












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.










share|improve this question





























    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.










    share|improve this question



























      0












      0








      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.










      share|improve this question
















      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.






      $("#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');
      }

      });
      }
      }





      $("#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');
      }

      });
      }
      }






      javascript internet-explorer jspdf html2canvas






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 '18 at 13:54







      karun

















      asked Nov 19 '18 at 14:37









      karunkarun

      12




      12
























          1 Answer
          1






          active

          oldest

          votes


















          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






          share|improve this answer
























          • 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 6: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 6:23











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376896%2fdownload-html-and-svg-to-pdf-client-side%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          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






          share|improve this answer
























          • 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 6: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 6:23
















          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






          share|improve this answer
























          • 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 6: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 6:23














          0












          0








          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






          share|improve this answer













          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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 3:19









          Deepak-MSFTDeepak-MSFT

          790116




          790116













          • 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 6: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 6:23



















          • 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 6: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 6:23

















          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 6:56





          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 6: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 6:23





          @ 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 6:23




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376896%2fdownload-html-and-svg-to-pdf-client-side%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Combustion

          Academy of Television Arts & Sciences

          L'Équipe