0
votes

i have an ASP.Net application with crystal reports. when i click on the print icon on the viewer, export to PDF appears. i added a button to custom print the generated report.

System.Drawing.Printing.PrintDocument cprPrinter = new System.Drawing.Printing.PrintDocument();
reportDocument.PrintOptions.PrinterName = cprPrinter.PrinterSettings.PrinterName;
reportDocument.PrintToPrinter(0, false, 0, 0);

what's happened when i published site on the iis server, "cprPrinter.PrinterSettings.PrinterName" take the server default printer not the client.

How can we access the client default browser to auto print report on click on the button, or print dialog appears?

2

2 Answers

0
votes

As far as I know, it must bring up the dialog to print so that you grant it access

0
votes

did you tried this one, hope this can help you.

          crystalReport.PrintOptions.PrinterName = GetDefaultPrinter();
          crystalReport.PrintToPrinter(1, false, 0, 0);