Skip to content

koukitsuko/html2pdf.js

 
 

Repository files navigation

@koukitsuko/html2pdf.js

A fork of html2pdf.js with modern build tooling and improved HTML rendering.

Changes from the original

This fork makes the following improvements to the original html2pdf.js:

  1. Replaces html2canvas with html2canvas-pro for improved HTML rendering
  2. Uses modern build tooling to provide ESM, CommonJS, and UMD builds
  3. Simplified package structure for easier use in modern JavaScript environments

Installation

# Using npm
npm install @koukitsuko/html2pdf.js

# Using pnpm
pnpm add @koukitsuko/html2pdf.js

Usage Examples

ESM Import (Recommended)

import html2pdf from '@koukitsuko/html2pdf.js';

// Generate PDF from element
const element = document.getElementById('element-to-print');
html2pdf().from(element).save('my-pdf.pdf');

CommonJS

const html2pdf = require('@koukitsuko/html2pdf.js');

// Generate PDF from element
const element = document.getElementById('element-to-print');
html2pdf().from(element).save('my-pdf.pdf');

Documentation

For detailed API documentation, options, and advanced usage, please refer to the original html2pdf.js documentation.

Development

Build Commands

# Install dependencies
pnpm install

# Build development version
pnpm run dev

# Build production version
pnpm run build

Building and Contributing

  1. Clone the repository
  2. Install dependencies with pnpm install
  3. Make changes to files in the src directory
  4. Build with pnpm run build
  5. Test your changes
  6. Submit a pull request

Credits

This project is a fork of html2pdf.js by Erik Koopmans.

License

The MIT License

Copyright (c) 2017-2019 Erik Koopmans <http://www.erik-koopmans.com/>

About

Client-side HTML-to-PDF rendering using pure JS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 62.3%
  • HTML 37.6%
  • CSS 0.1%