Easily print Pdf link in Javascript/Angular (Solved)

<link rel="stylesheet" type="text/css" href="https://printjs-4de6.kxcdn.com/print.min.css"><script src="https://printjs-4de6.kxcdn.com/print.min.js"> </script>
printJS({printable:'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf', type:'pdf', showModal:true})
  1. npm install print-js --save
  2. import printJS from 'print-js'; in component.ts code
  3. tsconfig.json: "allowSyntheticDefaultImports": true, option incompilerOptions
ngOnInit() {printJS({printable:'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf', type:'pdf', showModal:true})
}

--

--

--

Full Stack Engineer (Web/App) working on different JS Technologies & frameworks— Angular, Node, Typescript, Ionic, Firebase, AWS, ElK...Love to write cool stuff

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Controlling Time with Zone.js and FakeAsync

How to deploy NextJS on Netlify (with Server-Side Rendering)

How to solve index conflicts when we remove indexes in random order from an array?

What’s StrictMode in React?

Thunks in Redux: The Basics

How Much Does It Cost to Build a Successful Web App? The Complete Guide

Coding Austin Coding Academy week 8

Create Weather App Using React JS , Tailwind CSS, & TypeScript Part 2— Slicing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shivam Gupta

Shivam Gupta

Full Stack Engineer (Web/App) working on different JS Technologies & frameworks— Angular, Node, Typescript, Ionic, Firebase, AWS, ElK...Love to write cool stuff

More from Medium

CS373 Spring 2022: Ruchi Bhalani Week 6

Connection between ESP8266 Nodemcu and PHP with MySQL using DHT11 sensor

Things to know about Java 18 New Release

Corporate ID: Project 2