2.0.6 • Published 10 months ago

light-print v2.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
10 months ago

light-print

ci npm bundle size npm license

A lightweight print tool for the browser.

Install

npm install --save light-print
# or
yarn add light-print
# or
pnpm add light-print

Usage

Print container elements and their descendants.

import lightPrint from 'light-print';

lightPrint('#id', { mediaPrintStyle: `@page { size: A4 portrait }` }).then(() => {
  // do something when exiting the print window.
});
  • The argument can either be a CSS selector or an actual DOM element.
  • Returns a Promise when exiting the print window.

Types

interface PrintOptions {
  /** document title */
  documentTitle?: string;
  /** additional print style when printing */
  mediaPrintStyle?: string;
  /** page zoom */
  zoom?: number | string;
}

function lightPrint(containerOrSelector: Element | string, options?: PrintOptions): Promise<void>;
2.0.6

10 months ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

1.2.0

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago