spi-pdf

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i spi-pdf

Weekly Downloads

0

Version

0.0.1

License

ISC

Unpacked Size

2.8 kB

Total Files

4

Last publish

Collaborators

  • crisguzmans