New to Telerik Reporting? Download free 30-day trial

Preview Reports in Desktop Viewers Using REST Service Deployed in Azure

Environment

Product Progress® Telerik® Reporting
Viewer WinForms, WPF, WinUI

Description

Telerik Reporting REST Service can run on Windows and Linux machine with .NET Framework, .NET Core or .NET, which makes it suitable for various deployment scenarios in Azure. In order to render reports, the engine uses the GDI+ library, which is currently available in Basic and higher App Service plans. Even these implementations have some GDI API restrictions that affect the image rendering.

When working with a desktop client (WinForms, WPF or WinUI), by default the report is rendered using the ImageRendering extension in a Metafile. We use metafiles, because it is a vector format, hence provides scaling/zooming without quality loss. Because metafiles are currently not supported in Azure, an error occurs when rendering a report in a desktop Report Viewer.

The same applies to printing, which is esentially the same process - rendering the report definition in a metafile, which is sent to the printer.

Solution

The Reporting engine can be configured to use different output formats for rendering and printing the reports in viewers. These configurations are set up in the application configuration file and determine the type of the output image for each rendering extension. A sample configuration that can be used in Azure, because it forces the report to be previewed and rendered in PNG format is shown below:

<Telerik.Reporting>
    <extensions>
    <render>
        <extension name="IMAGEInteractive">
        <parameters>
            <parameter name="OutputFormat" value="PNG"/>
        </parameters>
        </extension>
        <extension name="IMAGE">
        <parameters>
            <parameter name="OutputFormat" value="PNG"/>
        </parameters>
        </extension>
        <extension name="IMAGEPrintPreview">
        <parameters>
            <parameter name="OutputFormat" value="PNG"/>
        </parameters>
        </extension>
        <extension name="IMAGEPrint">
        <parameters>
            <parameter name="OutputFormat" value="PNG"/>
        </parameters>
        </extension>
    </render>
    </extensions>
</Telerik.Reporting>

Additional settings

When the report is exported in any of the formats that use the OpenXML SDK, additional rendering extension parameter determines how the Graph and Map items will be rendered. The parameter is named UseMetafile and its default value is true, which ensures better image quality in Microsoft Office applications. This setting will be respected only if the rendering machine supports metafiles - otherwise a Bitmap instance is used to render the Graph and Map items.

If the export to Microsoft Office formats fails in Azure environment, set the UseMetafile to false.

See Also

In this article