Print.js was primarily written to help us print PDF files directly within our apps, without leaving the interface, and no use of embeds. For unique situations where there is no need for users to open or download the PDF files, and instead, they just need to print them. One scenario where this is useful, for example, is when users request to print reports that are generated on the server-side. These reports are sent back as PDF files. There is no need to open these files before printing them. Print.js offers a quick way to print these files within our apps.

1) Download and Install

You can either download the latest version(v1.2.0) of Print.js from the GitHub releases or use one of the two steps given below depending on your package manager.

  • To install using npm:
npm install print-js --save
  • To install using yarn:
yarn add print-js

After installing via npm or yarn, you should import the library into your project, as shown below, prior to starting using it.

import print from 'print-js'

#code #javascript #libraries #printing #html

The Easiest Way to Print Documents With Javascript — Print.js
4.00 GEEK