We recommend using Visual Studio 2017

ReportDocument.PrintToPrinter Method

Prints the specified pages of the report to the printer selected using the PrintOptions.PrinterName property. If no printer is selected, the default printer specified in the report will be used.

Namespace   CrystalDecisions.CrystalReports.Engine
Assembly  CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

public virtual void PrintToPrinter (
	int nCopies,
	bool collated,
	int startPageN,
	int endPageN
)

Parameters

nCopies

Indicates the number of copies to print.

collated

Indicates whether to collate the pages.

startPageN

Indicates the first page to print.

endPageN

Indicates the last page to print.

To print all pages, set the startPageN and endPageN parameters to zero.

This example sets the report's page margins, selects the printer, and prints the report.


      private void PrintReport(string printerName)
      {
         PageMargins margins;

         margins = reportDocument.PrintOptions.PageMargins;
         margins.bottomMargin = 350;
         margins.leftMargin = 350;
         margins.rightMargin = 350;
         margins.topMargin = 350;
         reportDocument.PrintOptions.ApplyPageMargins(margins);

         reportDocument.PrintOptions.PrinterName = printerName;

         reportDocument.PrintToPrinter(1, false,0,0);
      }
      

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002
Show: