Teleprint

The teleprint function

Print HTML like a boss

  • When 'window.print()' is called, the current document can be printed by the browser.
  • In order to print custom HTML instead of the whole document, HTML will be injected into an iframe.
  • When 'iframe.print()' is called, the injected HTML can be printed by the browser.
  • HTML assets can also be injected into the iframe document and applied to the injected HTML.
Arguments:
Name Type Description
config Object

The print job configuration.

Properties
Name Type Description
template Object

The content that will be printed.

Properties
Name Type Description
url String

The path to the content that will be printed.

html String

A HTML string that will printed.

element Object

An element whose outerHTML will be printed.

assets Array

URLs for individual assets.

inherit Object | Boolean

Set to true to inherit all styles and scripts from the current document.

Properties
Name Type Description
css Boolean

Copy all the styles from the current document to the print document.

js Boolean

Copy all the scripts from the current document to the print document.