Socket
Socket
Sign inDemoInstall

print-job

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

print-job

Print a single HTML container


Version published
Maintainers
1
Created
Source

print-job

This small JavaScript library prints a single HTML container.

Features

  • No popup windows or iFrames
  • No moving and replacing HTML
  • Preserve styles inherited from parent elements

Install

npm install --save print-job

Usage

In the browser

If the library is directly sourced to the window, it operates on the PrintJob global variable:

window.PrintJob
In ES6
import PrintJob from 'print-job';

Documentation

Print a container

You can pass in any valid selector, but only the first element found will be printed.

PrintJob.print('#areaYouWantToPrint');

You can alternatively pass in an element instead of a selector:

let element = document.getElementById('areaYouWantToPrint');
PrintJob.print(element);

Print an external image

Print just an image by supplying an external URL to the .image() method. This is handy for printing a large version of an image found on the page.

PrintJob.image('url/to/image.jpg');

Note: Because the image has to be fetched, your application code will continue to run after calling this method. The image will be printed the moment it loads.

Upcoming Features

  • Use custom print CSS
  • Lifecycle callbacks
    • Before print
    • After print
  • Preset jobs (set up the job and print later)

Keywords

FAQs

Package last updated on 01 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc