simple-html2pdf

simple-html2pdf JS library on GitHub simple-html2pdf JS library on npm Download simple-html2pdf JS library

Simple HTML-to-PDF using html2canvas and jsPDF.

Version 2.1.1 License MIT
simple-html2pdf has no homepage
simple-html2pdf JS library on GitHub
simple-html2pdf JS library on npm
Download simple-html2pdf JS library

Simple HTML2PDF

NPM Downloads NPM Version

Client-side Simple HTML-to-PDF using html2canvas and jsPDF.

Usage

$ npm install simple-html2pdf --save
# or
$ yarn add simple-html2pdf
import html2pdf from 'simple-html2pdf';

// html2pdf(element[, options][, callback])
html2pdf(document.body, {
  filename: 'file.pdf', // default 'file.pdf'
  margin: 40, // default 40, page margin
  save: true, // default true: Save as file
  output: '', // default '', jsPDF output type
  smart: true // default true: Smartly adjust content width
}, output => { console.log('finish!', output); });
<script src="https://unpkg.com/simple-html2pdf"></script>
<script>
  // html2pdf(element[, options][, callback])
</script>

Options

  • output string optional

jsPDF doc

Possible values are 'save', 'arraybuffer', 'blob', 'bloburi'/'bloburl', 'datauristring'/'dataurlstring', 'datauri'/'dataurl', 'dataurlnewwindow', 'pdfobjectnewwindow', 'pdfjsnewwindow'.