水晶报表自定义纸张大小打印 (Crystal Report Print with custom paper size)

时间:2021-09-04 11:42:11
  System.Drawing.Printing.PrintDocument doc = new PrintDocument();
            doc.PrinterSettings.PrinterName = "NFCP LQ1600K";
            int rawKind = 1;
            for (int i = 0; i <= doc.PrinterSettings.PaperSizes.Count - 1; i++ )
            {
                if (doc.PrinterSettings.PaperSizes[i].PaperName == "Test1")
                {
                    rawKind = doc.PrinterSettings.PaperSizes[i].RawKind;
                }
            }

            WindowsApplication1.CrystalReport5 rpt = new CrystalReport5();
            ReportDocument rptDoc = (ReportDocument)rpt;
            rptDoc.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
            rptDoc.PrintToPrinter(1, true, 0, 0);