Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing a pdf file on client side printer in asp.net C#?

I have a problem in my project that i open a dynamically generated PDF file in popup window which working correctly. But now i want to print that pdf directly when popup is open at client side printer, how can i solved it ??

I need help of yours. Please suggest me some code for this.

like image 513
Nick Vara Avatar asked Sep 17 '25 15:09

Nick Vara


1 Answers

You need to open the popup with javascript and the fire the print() function on it.

var opts = 'width=700,height=500,toolbar=0,menubar=0,location=1,status=1,scrollbars=1,resizable=1,left=0,top=0';
var newWindow = window.open(yourUrl,'name',opts);
newWindow.print();

Note that the url you open must be in the same domain as your current page for this to work.

like image 74
Joel Peltonen Avatar answered Sep 20 '25 03:09

Joel Peltonen