2
votes

I have a report designed in Crystal Rerports 12x8.5 inch. I have my OKI 3320 printer driver set exactly to this size. Now, when I print the report using my C# code, the page length is half inch short of the tear off position. I have to roll up paper to tear it off. Is there any settings we can change through code to exactly get to the tear off position?

          ReportDocument oReportDocument = new ReportDocument();
            oReportDocument.Load(reportPath + "\\OutDkt.rpt");

            List<TblOutDocket> lstDockets = new List<TblOutDocket>();
            lstDockets.Add(oTblOutDocket);
            oReportDocument.SetDataSource(lstDockets);

            oReportDocument.PrintOptions.PrinterName = LocalPrintServer.GetDefaultPrintQueue().FullName;
            oReportDocument.PrintToPrinter(1, false, 0, 0);
1

1 Answers

1
votes

It seems when you are using custom page sizes you need to specify the page settings specifically. According to this link you can achieve this by setting the PageSettings namespace.

When you want to use a papersize with an id greater then 118 (Windows coded papersize) you must supply the id of your papersize to PrintOptions.PaperSource. Obviuosly you need to cast it at CrystalDecisions.Shared.PaperSource I do this:

ReportDocument.PrintOptions.PaperSource = (CrystalDecisions.Shared.PaperSource)m_PageSettings.PaperSource.RawKind;

ReportDocument.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)m_PageSettings.PaperSize.RawKind;

Where m_PageSettings is my System.Drawing.PageSettings that specify the right PaperSize