Default paper size

edited 1:32PM in FastReport .NET

I would like to see a option in the Page Setup / Paper Size like "Default". Then the report would use the size defined in the Windows when the user opens the report.

Our reports are used in many countries, countries use different paper sizes but basically (letter in US and A4 in Europe). It would be nice that the report uses the default paper size each time that the users open it.

If adding this option in Page Setup is too complex, is there a trick via source to get the same result?

Thank you



Comments

  • edited 1:32PM
    The first problem is that you have to query the default printer about its default paper size. It must be done before running a report. It may take quite long time (upto 5sec even for the local printer, and even more for the network printer). The second problem is a design of a report. If you try to print a report that was originally designed in letter-size on A4 paper, the text will probably gets cut off.

    You can do this programmatically:
    Report report = new Report();
    report.Load(...);
    
    // query the default printer to get the default paper size in millimeters
    float paperWidthMM = ...;
    float paperHeightMM = ...;
    
    // change the size of each ReportPage
    foreach (PageBase page in report.Pages)
    {
      if (page is ReportPage)
      {
        (page as ReportPage).PaperWidth = paperWidthMM;
        (page as ReportPage).PaperHeight = paperHeightMM;
      }
    }
    
    report.Show();
    

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.