node-htmlpdf
v1.0.4
Published
Converts Html to Pdf file
Downloads
189
Maintainers
Readme
#node-htmlpdf
Converts Html file or buffer to Pdf using headless Browser
#Installation
npm i node-htmlpdf
#Example
const htmlpdf =require('node-htmlpdf')
let html =`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hello world</h1>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Culpa odit veritatis dolor enim quia deleniti aut minus magni beatae. Sit atque rem vitae alias recusandae fugit sed aliquam nihil illo.</p>
</body>
</html>`
node-htmlpdf.create(
html,
{path:'./test.pdf',
format:'A4'},
null).then((buff)=>{
console.log(buff)
});
#Options
Path : "Path to create Pdf file" format: A4, letter landscape: Bool (true , false), height: Height of Pdf width: width of Pdf margin: top, left , botton right
License
MIT Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.