Reputation: 111
I have created a report in crystal report and my problem is that my code is not making picking windows default printer don't know y.. Application at the point of printing is picking the pdf printer but have set the highlighted printer as default
And here is my code to print the report
MyCrystalReport rep=new MyCrystalReport();
rep.SetParameterValue("cash_tendered", "100");
rep.SetParameterValue("change", "50");
rep.SetParameterValue("pay_mode","Cash");
try
{
rep.PrintToPrinter(1, false, 0, 0);
}
catch (Exception ex)
{
AppUtil.showErrorBox("Printer Error!!\n" + ex.Message);
}
Upvotes: 0
Views: 2782
Reputation: 2111
You can use PrinterName Property to achieve this.
var dialog= new PrintDialog();
rep.PrintOptions.PrinterName = dialog.PrinterSettings.PrinterName;
rep.PrintToPrinter(1, false, 0, 0);
Upvotes: 1
Reputation: 1422
In your report designer go into Page Setup and check the Printer Options section. It should be set to either the printer you want to use for the report, or check the check box for "No Printer".
Upvotes: 1