This project provides a set of utilities for converting various file formats without the need for additional dependencies. It supports multiple file types and leverages technologies like Puppeteer and PDFKit for file processing.
Features
HTML to PDF: Converts HTML content (from a URL or file path) into a PDF.
Image to PDF: Converts images (JPEG, PNG) into a PDF, with optional headers and footers.
PDF to Image: Converts PDF files to image formats (JPEG or PNG) using Puppeteer and Firefox.
Utilities: Includes helper functions to fetch and read HTML files and read files from local directories.
Requirements
Node.js: This project is built with Node.js and uses ES modules. NodeJS > v20 required.
Operations Available in the Package
1. html2pdf
Function Signature:
html2pdf(input:string|URL)
Validation occurs on the html string passed. The Error Object returned is: