ActiveReports 18 .NET Edition
Developers / Export Reports / Export Page/RDLX Reports / Image Export
In This Topic
    Image Export
    In This Topic

    Image is the format that converts your report to an image file. You can use the ImageRenderingExtension to render your report in this format. Make sure that you select an ImageType to any of the six different image formats available: BMP, GIF, JPEG, TIFF, and PNG.

    Note: By default, the image rendering extension creates a separate file for each page in a report and adds an index to each corresponding file name (for example, image001.PNG, image002.PNG, etc).

    To render the entire report as a single image, set the Pagination setting to False.

    Image Rendering Properties

    ActiveReports offers several options to control how reports render to Image.

    Property Description
    Compression Sets or returns a value which specifies the compression to be used when exporting.
    Dither Specifies whether the image should be dithered when saving to a black and white output format, like CCITT3 or Rle. This property has no effect if the CompressionScheme property is set to Lzw or None(represents color output).
    DpiX Adjust the horizontal resolution of rendered images. The default value is 96.
    DpiY Adjust the vertical resolution of rendered images.
    EndPage The default value of 0 in this property renders all of the report pages. Otherwise, set this value to the number of the last page to render. Please note that if the StartPage property is set to 0, all of the pages of the report render. In order to use the EndPage property, you must set the StartPage property to a valid non-zero number.  
    ImageType Select the type of image to which you want to render the report. Supported types are BMP, GIF, JPEG, TIFF, and PNG.
    PageHeight Set the value in inches to use for the height of the image. The format is an integer or decimal with "in" as the suffix, for example, "11in" for 11 inches. The value set in this property overrides the report's settings.
    PageWidth Set the value in inches to use for the height of the image. The format is an integer or decimal with "in" as the suffix, for example, "11in" for 11 inches. The value set in this property overrides the report's settings.
    Pagination By default, each page of a report is rendered as a separate image. Set this value to False to render the entire report as a single image.  
    PrintLayoutMode Select how to lay out the pages of the report in the image.
    • OneLogicalPageOnSinglePhysicalPage
    • TwoLogicalPagesOnSinglePhysicalPage
    • FourLogicalPagesOnSinglePhysicalPage
    • EightLogicalPagesOnSinglePhysicalPage
    • BookletMode (lays the pages out for booklet printing)
    Quality Gets or sets the quality of the report to be rendered as an image.
    SizeToFit By default, rendered report pages are not resized to fit within the selected image size. Set this value to True to resize the report pages.
    Start Page The default value of zero in this and the EndPage properties render all of the report pages to images. Otherwise, set this value to the number of the first page to render.
    WatermarkAngle Specify the degree of angle for the watermark text on the image. Valid values range from 0 to 359, where 0 is horizontal, left to right.
    WatermarkColor Select a color for the watermark text on the image. The default value for the watermark color is gray, but you can select any Web, System, or Custom color.
    WatermarkFontName Set the font to use for the watermark on the PDF document.
    WatermarkFontSize Set the font size to use for the watermark on the PDF document.
    WatermarkFontStyle Set the font style to use for the watermark on the PDF document.
    WatermarkTitle Sets text (i.e. CONFIDENTIAL) to use as the watermark on the image.

    Export Report using Image Rendering Extension

    Reports rendered as images do not support any of the interactive features of Active Reports. Any data hidden at the time of export is hidden in the image. To display all data in a drill-down report, expand all toggle items prior to exporting.

    The following steps provide an example of rendering a report in Image format.

    1. Create a new Visual Studio project.
    2. In the New Project dialog that appears, select ActiveReports 18 Page report Application and specify a name for the project in the Name field.
    3. Click OK to create a new ActiveReports 18 Page report Application. By default, a Page report is added to the project.
    4. Add a reference to MESCIUS.ActiveReports.Export.Image package in the project.
    5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
    6. Add the following code inside the Form_Load event.
    Visual Basic.NET code. Paste INSIDE the Form Load event.
    Copy Code
    ' Provide the Page report you want to render.
    
    Dim rptPath As New IO.FileInfo("..\..\PageReport1.rdlx")
    
    Dim pageReport As New GrapeCity.ActiveReports.PageReport(rptPath)
    
    ' Create an output directory.
    Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyImage")
    outputDirectory.Create()
    
    ' Provide settings for your rendering output.
    Dim imageSetting As New GrapeCity.ActiveReports.Export.Image.Page.Settings()
    Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = imageSetting
    
    ' Set the rendering extension and render the report.
    Dim imageRenderingExtension As New GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension()
    Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
    
    ' Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = True
    
    pageReport.Document.Render(imageRenderingExtension, outputProvider, imageSetting)
    
    C# code. Paste INSIDE the Form Load event.
    Copy Code
    // Provide the Page report you want to render.
    System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
    
    GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);// Create an output directory.
    System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyImage");
    outputDirectory.Create();
    
    // Provide settings for your rendering output.
    GrapeCity.ActiveReports.Export.Image.Page.Settings imageSetting = new GrapeCity.ActiveReports.Export.Image.Page.Settings();
    GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = imageSetting;
    
    // Set the rendering extension and render the report.
    GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension imageRenderingExtension = new GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension();
    GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
    
    // Overwrite output file if it already exists.
    outputProvider.OverwriteOutputFile = true;
    
    pageReport.Document.Render(imageRenderingExtension, outputProvider, imageSetting);