spi-pdf
v0.0.1
Published
Creador de PDF a apartir de un html y variables
Downloads
3
Readme
Requeriments
sudo apt install libcairo2 sudo apt install libpango-1.0-0 sudo apt install libxkbcommon0 sudo apt install libgbm1 sudo apt install libxdamage1
Quick start
Create a fille:
<html>
<head>
<title>HTML content</title>
</head>
<body>
<h1>Sample</h1>
<div>
<p>
This is my file {{myVariable}}
</p>
</body>
</html>
const { PDF } = require("@spi/pdf");
const file = './my-document.html'
const pdf = PDF.fromPath(file, {
myVar: 'Amazing file'
});
pdf.store(process.cwd() + '/salud/documentos/encuesta.pdf'); // will store a pdf file
pdf.toResponse(process.cwd() + '/newFile.pdf'); // will generate a base64 string
pdf.toBase64() // Will generate base64 string