Morgan Denis
Morgan Denis

Reputation: 111

Crystal Report is always picking pdf printer as default

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.here is my printers. 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

Answers (2)

Chetan Sanghani
Chetan Sanghani

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

R. McMillan
R. McMillan

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

Related Questions