html-canvas-2-pdf-export
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

html-canvas-2-pdf-export

html-canvas-2-pdf-export is an npm package that provides a utility function for exporting HTML content, including WebGL, to a PDF file. It includes functions for capturing a specified HTML element and generating a PDF from it.

Installation

You can install html-canvas-2-pdf-export using npm:

npm install html-canvas-2-pdf-export

Usage

Once you've installed canvas-pdf-export, you can use it in your JavaScript or Node.js code.

// Import the exportToPDF function
const { exportToPDF } = require('canvas-pdf-export');

// Specify the HTML element you want to capture
const elementToCapture = document.querySelector("#main-chart-container");

// Call the exportToPDF function with the element to capture
exportToPDF(elementToCapture);

// You can pass the filename also 
exportToPDF(elementToCapture,'my-first-pdf');

The exportToPDF function takes an HTML element as its argument and generates a PDF from the content within that element, including WebGL.

Acknowledgments

html2canvas: Used for capturing HTML content to a canvas.

jsPDF: Used for generating PDF files from the captured canvas.

Issues

If you encounter any issues or have questions, please open an issue on the GitHub repository.

Package Sidebar

Install

npm i html-canvas-2-pdf-export

Weekly Downloads

2

Version

3.0.0

License

ISC

Unpacked Size

3.6 kB

Total Files

7

Last publish

Collaborators

  • imsonujangra