JSPM

@yaakadev/pdf-render

1.2.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 4
    • Score
      100M100P100Q62977F
    • License MIT

    Render PDF from HTML using Chrome's Puppeteer API

    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-render

    Exemple

    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);
        });