1.1.0 • Published 3 years ago

react-dom-to-pdf v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

dom-to-pdf

react-dom-to-pdf generates a printable PDF from DOM node using HTML5 canvas and svg.

Install

npm install --save react-dom-to-pdf

Usage

var domToPdf = require('react-dom-to-pdf');

var element = document.getElementById('test');
var options = {
  filename: 'test.pdf'
};
domToPdf(element, options, function() {
  console.log('done');
});

Options

  • filename - string, name of resulted PDF file, default name is generated.pdf
  • excludeClassNames - array of strings, list of class names of elements to exclude from PDF, e.g. ['Loading', 'ExcludeMeFromPdf']
  • excludeTagNames - array of strings, list of html tags to exclude from PDF, e.g. ['button', 'input', 'select']
  • overrideWidth - number, overrides a width of a container DOM element
  • proxyUrl - string, e.g. /api/proxyImage?url=, a route in your app which renders images on your domain in order to avoid problems with CORS with the images on a DOM
  • compression - string, compression of the generated image, can have the values 'NONE', 'FAST', 'MEDIUM' and 'SLOW'. (default is 'NONE')
  • margin - Array, default value 0,0,0,0 change margin top, right, bottom, left.
1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago