1.2.4 • Published 5 years ago

print-dom v1.2.4

Weekly downloads
53
License
MIT
Repository
github
Last release
5 years ago

print-dom

Lightweight and fast print tool for browser.

downloads GitHub stars devDependencies npm-version Github tag Build Status GitHub license

Demo

Try it out

Advantages

  • Simple API.
  • Small bundle size: 3.8KB (1.54KB gzipped).
  • No dependencies.
  • Faster than print-js

Installation

npm i print-dom -S

# OR

yarn add print-dom -S

Usage

import printDOM from "print-dom";

printDOM(document.querySelector("#print"));

with options

import printDOM from "print-dom";

printDOM(document.querySelector("#print"), {
  noPrint: [".header"],
  documentTitle: "Nice!!!",
  wrapClass: ".print-wrapper",
  style: ".print-wrapper { font-size: 16px; }",
});

Options

PropertyDescriptionTypeDefault
noPrintIgnore list when printing.String[][".no-print"]
documentTitlePrint page's title.StringParent page's title.
styleCustom style.Stringvoid
wrapClassPrint element's className.Stringvoid
processorProcess the DOM before print.(el: HTMLElement) => HTMLElementvoid
onPrintDialogCloseRun when the browser print dialog is closed.() => voidvoid

Build

yarn build

Todo

  • Add test files.

License

MIT © zh-rocco

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago