light-print
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

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>;

Readme

Keywords

Package Sidebar

Install

npm i light-print

Weekly Downloads

7

Version

2.0.6

License

MIT

Unpacked Size

19 kB

Total Files

8

Last publish

Collaborators

  • xunmi