Mahe

Mahe

  • NA
  • 38
  • 1.8k

Printing Issue in Windows Application (.Net, C#)

Dec 8 2015 1:15 AM
Hi All, 
Am working in Windows Application (.Net , C#). It involves in generating a PDF and printing the PDF. Am able to generate and print the PDF.   
For Printing i used following lines of code.
 
[code] 
String file = @"C:\PDFOutput\RegistrationDetail.pdf"; 
Process p=new Process(); 
 
PrinterSettings printer = new  PrinterSettings();
obj.PrinterName ="10.11.12.13";
 
ProcessStartInfo pinfo = new  ProcessStartInfo(file);
pinfo.Verb ="PrintTo";
pinfo.CreateNoWindow = true;
pinfo.WindowStyle= ProcessWindowStyle.Hidden;
p.StartInfo =pinfo;
p.Start(); p.close(); 
[/code]
 
I need to configure printer (10.11.12.13) as default printer in my dev machine(app server) and then i need to execute the application to work properly. In case i need to change the printer,  i need to add the new printer as default printer and then need to execute the process. Is there any alternate way to accomplish this printing without adding as default printer and i can modify the printer dynamically. 
 
thanks in advance. 
 
 Regards,
Mahe 

Answers (3)