@lesjoursfr/html-to-pdf
TypeScript icon, indicating that this package has built-in type declarations

3.1.7 • Public • Published

npm version QC Checks

@lesjoursfr/html-to-pdf

Generate PDF from HTML with simple API in Node.js.

What is this library?

This library use electron to generate PDF files from HTML.

Usage

Install the lib and add it as a dependency :

    npm install @lesjoursfr/html-to-pdf

Then put this in your code:

    const { PDF } = require("@lesjoursfr/html-to-pdf");

    const pdf = new PDF(target, output);
    pdf.render()
        .then(() => {
            console.log("PDF Generated Successfully!")
        })
        .catch((err) => {
            console.error("Failed to generate PDF because of ", err)
        });
    );

Parameters

  • target: The URL of the HTML page
  • output: The PDF file path

/@lesjoursfr/html-to-pdf/

    Package Sidebar

    Install

    npm i @lesjoursfr/html-to-pdf

    Weekly Downloads

    3

    Version

    3.1.7

    License

    MIT

    Unpacked Size

    11.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • e-adrien