private void PrintReport(string reportPath, string PrinterName) { CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(reportPath); CrystalDecisions.Shared.PageMargins objPageMargins; objPageMargins = rptDoc.PrintOptions.PageMargins; objPageMargins.bottomMargin = 100; objPageMargins.leftMargin = 100; objPageMargins.rightMargin = 100; objPageMargins.topMargin = 100; rptDoc.PrintOptions.ApplyPageMargins(objPageMargins);
rptDoc.PrintToPrinter method prints the specified report pages on a printer selected using the PrintOptions.PrinterName property.
If no printer is selected, the default printer specified in the report will be used.
We use the PrintToPrinter method as:
public void PrintToPrinter (int nCopies , boolean collated , int startPage , int endPage );
Where:
nCopies indicates the number of copies to print. A.collated indicates whether to match pages.startPage indicates the first page to print. A.endPage indicates the last page to print. A.
user5452645
source share