Package Exports
- @yaakadev/pdf-render
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@yaakadev/pdf-render) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PDF Render
Une bibliothèque pour transformer un document HTML en un fichier PDF pour les environnments NodeJS.
PDF Render se base sur la bibliothèque puppeteer qui permet de manipuler une instance d'un navigateur Chrome.
Les valeurs par défaut de certaines options ont été adaptées pour mieux répondre aux besoins de YAAKADEV.
Installation
npm install @yaakadev/pdf-renderExemple
const Renderer = require('@yaakadev/pdf-render');
const htmlDoc = `
<!DOCTYPE html>
<html>
<head>
<title>Mon document PDF</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
`;
const pdfRenderer = new Renderer();
pdfRenderer.renderHTML(htmlDoc, { path: './doc.pdf' })
.then(() => {
console.log('Le fichier doc.pdf a bien été généré');
})
.catch(err => {
console.error(err);
});