Torna al Thread

System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument(); pd.PrinterSettings.PrinterName = MyReport.PrinterName; foreach (System.Drawing.Printing.PaperSource ps in pd.PrinterSettings.PaperSources) { //Trim data from Driver, and take the first one that Starts with our PaperSource name (ie: 'Auto' matches 'Automatically Select' and 'Auto Select' ') if (ps.SourceName.Trim().StartsWith(MyReport.PaperSource)) { MyCrystalReport.ReportDoc.PrintOptions.CustomPaperSource = new System.Drawing.Printing.PaperSource(); MyCrystalReport.ReportDoc.PrintOptions.CustomPaperSource.RawKind = ps.RawKind; break; } } //If nothing matches MyReport.PaperSource it will use the papersource in the crystal RPT file instead of MyReport.PaperSource.
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5