0.0.4 • Published 5 years ago

dom-pdf v0.0.4

Weekly downloads
8
License
ISC AND ANTI-996
Repository
github
Last release
5 years ago

dom-pdf

Convert HTML DOM Element to PDF. You can save a specified element as PDF File, print it directly, or preview as PDF.

Work by '996', sick in ICU. Keep your work-life balance, be a developer with happiness!

Install

npm install --save dom-pdf

Usage

To use Printer class:

import { Printer } from 'dom-pdf';

const printer = new Printer();

printer.init(element, options).then(() => {
  printer.print();
  printer.preview();
  printer.save();
});

To use Vue plugin:

import { VuePlugin } from 'dom-pdf';

Vue.use(VuePlugin);

In your Vue component:

this.$print(element, options);
this.$previewPDF(element, options);
this.$savePDF(element, options);

Options

OptionDescription
orientationPaper orientation. Valid values: 'portrait', 'landscape'. Defaultly set to 'portrait'.
pageSizePaper size Valid values: 'a0' ~ 'a10', 'b0' ~ 'b10', 'c0' ~ 'c10', 'dl', 'letter', 'government-letter' 'legal' 'junior-legal' 'ledger' 'tabloid' 'credit-card'. Defaultly set to 'a4'.
pageMarginPage margin. Defaultly set to 30.
scaleScale. Defaultly set to 2.
0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago