JSPM

easy-html-to-pdf

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q35895F
  • License ISC

Convert and render HTML files easily to a PDF file

Package Exports

  • easy-html-to-pdf
  • easy-html-to-pdf/dist/index.js

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 (easy-html-to-pdf) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

easy-html-to-pdf

Upto the date lib for creating pdf files using HTML, internally using updated version of puppeteer for smooth integration.

Install

npm install --save dmarc-solution

How to use

Generate PDF with HTML Content

const pdf = require("easy-html-to-pdf").PDFGenerator;

const options = {
  format: "A4", //allowed formats - 'letter', 'legal', 'tabloid', 'ledger', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6'
  headerTemplate: "<p></p>",
  footerTemplate: "<p></p>",
  displayHeaderFooter: false,
  margin: {
    top: "40px",
    bottom: "100px",
    right: "0px",
    left: "0px",
  },
  landscape: false,
  printBackground: true,
  path: "test.pdf", //only required field
};

pdf.convertToPdf("<h1>Hello world</h1>", options);