fw-simple-html2pdf
v2.1.2
Published
Simple HTML-to-PDF using html2canvas and jsPDF.
Downloads
1
Readme
Simple HTML2PDF
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
Possible values are 'save', 'arraybuffer', 'blob', 'bloburi'/'bloburl', 'datauristring'/'dataurlstring', 'datauri'/'dataurl', 'dataurlnewwindow', 'pdfobjectnewwindow', 'pdfjsnewwindow'.