/savepdf

Primary LanguageHTML

Save PDF

on github pages - link

using: jsPDF

var saveBtn = document.getElementById('saveBtn');
var saveArea = document.getElementById('save-pdf');

saveBtn.addEventListener('click', function() {
  var pdf = new jsPDF('p', 'mm', 'a4');

  var options = {
    pagesplit: true,
    background: '#FFFFFF',
    width: saveArea.offsetWidth,
    height: saveArea.offsetHeight
  };

  pdf.addHTML(saveArea, options, function() {
    pdf.save('TestPdf.pdf');
  });
});