ng2-pdfjs-viewer icon indicating copy to clipboard operation
ng2-pdfjs-viewer copied to clipboard

How to download PDF by using external button?

Open kiranreddysn opened this issue 5 years ago • 1 comments

I have a requirement to download the PDF on button click, but i don't want to use the in-built download button. I found the solution how can do it using below code this.pdfViewer.startDownload = true; this.pdfViewer.refresh(); this.pdfViewer.startDownload = false;

But it reloads the PDF which is not good, is there a way i can download without refresh() ?

kiranreddysn avatar Jul 02 '20 04:07 kiranreddysn

@kiranhpe Just use plain old jQuery or Javascript and do a click() trigger on the viewer's download button.

See a sample here : https://stackoverflow.com/questions/3560227/jquery-javascript-trigger-button-click-from-another-button-click-event

codehippie1 avatar Feb 28 '21 04:02 codehippie1