private void Print() { RefreshReport(); string printerName = _reportService.GetPrinterNameForReport(); PaperSize NewSize = new PaperSize(); NewSize.RawKind = (int)PaperKind.Custom; NewSize.Width = 950; NewSize.Height = 1620; RDLCPrinter rdlcPrinter = new RDLCPrinter(reportViewer.LocalReport); rdlcPrinter.Print(printerName, 0, Duplex.Horizontal, NewSize, true); _reportService.SetReportEvidence(rdlcPrinter.GetPDFArray(), labelId); }
private void LoadDataReport() { //Create the local report LocalReport report = new LocalReport(); report.ReportEmbeddedResource = "RDLCDemo.ReportTest.rdlc"; //Create the dataset this._northWindDataSet = new NorthwindDataSet(); this._dataAdapter = new NorthwindDataSetTableAdapters.ProductsByCategoriesTableAdapter(); this._northWindDataSet.DataSetName = "NorthwindDataSet"; this._northWindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; this._dataAdapter.ClearBeforeFill = true; //Created datasource and binding source ReportDataSource dataSource = new ReportDataSource(); System.Windows.Forms.BindingSource source = new System.Windows.Forms.BindingSource(); dataSource.Name = "ProductsDataSources"; //the datasource name in the RDLC report dataSource.Value = source; source.DataMember = "ProductsByCategories"; source.DataSource = this._northWindDataSet; report.DataSources.Add(dataSource); //Fill Data in the dataset this._dataAdapter.Fill(this._northWindDataSet.ProductsByCategories); //Create the printer/export rdlc printer RDLCPrinter rdlcPrinter = new RDLCPrinter(report); rdlcPrinter.BeforeRefresh += rdlcPrinter_BeforeRefresh; //Load in report viewer ReportViewer.Report = rdlcPrinter; }