2.1.2 • Published 4 years ago

fw-simple-html2pdf v2.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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'.