Crystal Report | Print | Default printer

I am making one application where the user will print the invoices that I display with Crystal Report.

A user showed me his current application made using ForPro. In this application, in the "Printer Settings" form, you can see all currently installed printers, and the user can select the default printer. When the account is completed, the user presses the print button, then one dialog appears with a request for absence. copies. When entered, the invoice is printed directly, without the Print dialog box. If the user wants to change the printer again, he will change it in the "Printer Settings" form.

I want to know if this is possible in Crystal Report, and you need to be guided by how to approach it.

+3
source share
2 answers

Take a look at ReportDocument.PrintToPrinter SAP Documents or MSDN Documents on how to specify a printer name and then print it using the ReportDocument object.

If you can try to get away from the FoxPro application user interface for choosing a printer. Instead, use the standard print dialog to select a printer.

, , . .

PrintDialog SetParameterValue,

// Note: untested
var dialog = new PrintDialog();

Nullable<bool> print = dialog.ShowDialog();
if (print.HasValue && print.Value)
{
    var rd = new ReportDocument();

    rd.Load("ReportFile.rpt");
    rd.SetParameter("Parameter1", "abc");
    rd.SetParameter("Parameter2", "foo");

    rd.PrintOptions.PrinterName = dialog.PrinterSettings.PrinterName;
    rd.PrintToPrinter(1, false, 0, 0);
}
+10

SAP ISCDReportClientDocument, . , . .

    CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions printReportOptions = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions();
    CrystalDecisions.ReportAppServer.Controllers.PrintOutputController printOutputController = new CrystalDecisions.ReportAppServer.Controllers.PrintOutputController();
    CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
    rptClientDoc = cryRtp.ReportClientDocument;
    printReportOptions.PrinterName = pDialog.PrinterSettings.PrinterName;
    rptClientDoc.PrintOutputController.PrintReport(printReportOptions);


http://mattruma.azurewebsites.net/?p=258

+3

All Articles