How to set print Paper in code
Hello,
I have a small problem with print,
I want to set Printer(local printers, connected printers),
Print Paper(A3, A4, Letter etc), Page Orientation(Landscape, Portrait) in code before printing .
PrintSettings class only set Printer, like this:
Report.PrintSettings.ShowDialog = false;
Report.PrintSettings.Printer = "HP LaserJet P2015 Series PCL 6";
Report.Print();
Print Paper, Orientation, How to do?
I have a small problem with print,
I want to set Printer(local printers, connected printers),
Print Paper(A3, A4, Letter etc), Page Orientation(Landscape, Portrait) in code before printing .
PrintSettings class only set Printer, like this:
Report.PrintSettings.ShowDialog = false;
Report.PrintSettings.Printer = "HP LaserJet P2015 Series PCL 6";
Report.Print();
Print Paper, Orientation, How to do?
Comments
The ReportPage class has these properties. You have to set it before you generate the report.
ReportPage page = report.Pages[0] as ReportPage;
page.PaperWidth = 210;
page.PaperHeight = 297;
page.Landscape = true;
There is no property that sets the paper format (A3,A4) - you need to set PaperWidth, PaperHeight properties instead (they are in millimeters).
Report.PrintSettings.ShowDialog = true;
Report.Print();
it will pop up Print Dialog before print , we can set Print Paper etc in it, how to do it by Code?
System.Windows.Forms.PrintDialog has PrinterSettings.DefaultPageSettings to do it,
i see