Vector graphics custom report item

Posted by: Jens.Rickhoff on 17 June 2018, 6:31 pm EST

  • Posted 17 June 2018, 6:31 pm EST

    We have a proprietary custom report item implementation which renders a special chart based on our in-house charting technology. Similar to your Postnet/Treeview sample library we have a rendering class implementing IGraphicsRenderer and IImageRenderer, supplying the individual chart bitmaps.
    It works fine for us so far, but near-future requirements call for dozens or hundreds of such charts in a single report where we quickly run into memory and performance issues (especially on x86) since we're constantly creating and disposing large bitmaps. Additionally, scaling into the preview or into generated PDFs is only limited to the DPI we used for the bitmaps, while increasing the DPI only worsens the memory and performance problem.
    To solve these issues, we're planning to have our proprietary chart library export vector graphics, likely SVG format. How do I transfer the SVG through the custom report item implementation interfaces to ActiveReports so that the PDF will contain vector-based charts?
    I could not find information on this in either the document or the Postnet/TreeView example. I only found a forum entry (https://www.grapecity.com/en/forums/ar-dev/emf-vector-graphics-export) which only talks about including vector graphics files (emf/wmf) on disk.
  • Replied 18 June 2018, 8:37 pm EST

    Hello,

    Unfortunately, Active Reports has no support for SVG images in the layout. To use these images in your reports you should convert SVG files to one of the raster image formats (that is supported by ActiveReports).

    If you’re using code based Section report you can convert SVG to System.Drawing.Image type through code behind using of third party SVG library (http://svg.codeplex.com/releases/view/18884) and then use this value in PictureControlInstance.Image property assign the image.

    You should find useful the following link
    http://stackoverflow.com/questions/58910/converting-svg-to-png-using-c-sharp

    Thanks,
    Mohit
  • Replied 20 June 2018, 9:03 pm EST

    That does not seem to be completely correct. ActiveReports supports vector graphics, at least with its native report items like Chart. If I use a native Chart in my report, the rendered PDF contains a vector-based chart in its place, and not a raster image representation. Your suggested workaround does not apply to us, we currently already have a bitmap and like to move towards using a vector graphic for our custom report item.

    So since the ActiveReports PDF renderer does output vector graphics, it should be merely a question on how to pass a vector graphic custom report item representation (perhaps a System.Drawing.Imaging.Metafile which implements System.Drawing.Image?) through the IImageRenderer/IGraphicsRenderer interfaces so it is embedded in the PDF as a vector graphic.
    Does the IDrawingCanvas or ImageInfo accept a Metafile image? If so, it would be great if you could provide an example since I could not find any documentation on it.

    Thanks,
    Jens
  • Marked as Answer

    Replied 21 June 2018, 4:27 pm EST

    Hello Jens,

    the upcoming ActiveReports 13 (November, 2018) will contain the sample of the CustomReportItem that shows SVG images.

    Thanks,
    Sergey Romanov.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels