Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

All entries tagged jspdf.

You can subscribe to an RSS feed of this list.

Sep 2017

  • I have an HTML page with around 10 charts generated by chart.js (so these are canvas elements). I want to be able to export the page content into a PDF file.

    I’ve tried using jsPDF’s .fromHTML function, but it doesn’t seem to support exporting the canvas contents. (Either that or I’m doing it wrong). I just did something like:

        $(".test").click(function() {
      var doc = new jsPDF()
    
      doc.fromHTML(document.getElementById("testExport"));
      doc.save('a4.pdf')
    });
    

    Any alternative approaches would be appreciated.