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.
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.
Try This Code It will Work For You.
Process printjob = new Process();
printjob.StartInfo.FileName = @"D:\R&D\Changes to be made.pdf" //path of your file;
printjob.StartInfo.Verb = "Print";
printjob.StartInfo.CreateNoWindow = true;
printjob.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
PrinterSettings setting = new PrinterSettings();
setting.DefaultPageSettings.Landscape = true;
printjob.Start();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.