How to Display/Print Report Correctly from Windows Forms Viewer without Declaring the Entire Application as DPI-aware
Environment
Product | Progress® Telerik® Reporting |
Description
When the Windows Forms Viewer is used in a WinForms application that is not DPI-aware, when printing or previewing a report it may be incorrectly scaled.
The recommended solution is to set the application to DPI-aware as explained in Declaring the application as DPI-aware article section. However, this may result in the distortion of other controls in the application.
Solution
You may extract the viewer in a separate application, and call the latter when needed from the main application. Only the application with the viewer (with embedded Reporting engine) should be declared as DPI-aware.
You may move the Reporting engine in a separate Telerik Reporting REST Service and use the Windows Forms Viewer with the REST Service. It will be necessary to add the <dpiAware> section to the REST Service application's web.config and set the dpiAwareness attribute to PROCESS_SYSTEM_DPI_AWARE - dpiAware element.
You may test to run the application not declared as DPI-aware on a machine with Windows 10 Anniversary Update, where Windows runtime has improved the UX for Windows Forms applications that are not declared as DPI-aware. We cannot guarantee the report will be displayed as expected.
Another option, which is more suitable for printing the document rather than previewing it due to raster zoom, is to set the 'OutputFormat' attribute of ImageInteractive Device Information Settings to 'PNG' (the default is 'EMF'). In this case the zooming will not work well, as the report will be rendered as raster image (as opposed to vector image). This setting will take effect for reports displayed in Interactive mode in the Windows Forms Report Viewer.
The same approach can be applied for PrintPreview mode and Printing from the viewer by setting 'OutputFormat' to 'PNG' in the Image Device Information Settings (extensions IMAGEPrintPreview and IMAGEPrint).