How to set print Paper in code

edited 6:50PM in FastReport .NET
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?

Comments

  • edited 6:50PM
    Hello,

    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).
  • edited May 2009
    thank you

    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,
  • edited 6:50PM
    You cannot change paper after the report was built. You have to do this before you run a report.
  • edited 6:50PM
    tks
    i see

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.