html-canvas-2-pdf-export
v3.0.0
Published
This package will help you out for exporting your html content to pdf using webGL support
Downloads
15
Maintainers
Readme
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.