Share via


Custom Report Item Image Quality

Question:
How can I get print-quality output from my custom report item?

Answer:
Custom report items have slightly different plumbing than native report items.  Of particular note are native charts.  These are generated during report rendering, which means it is possible for us to vary both the type (raster or vector) and the DPI of the image based on the needs of the renderer.  For example, we currently use 300 DPI raster for PDF, vector for print and Winforms and 96 DPI raster for HTML and Excel.  Custom Report Items, on the other hand, are generated during processing.  This means only raster images can be used (since they must work with all renderers, including those which do not support vector images) and only a single DPI can be chosen for all rendering targets.

Custom Report Items should therefore generate a raster image of sufficiently high DPI as to be high quality when printed.  A default setting of 300 DPI should be sufficient for most applications.  However, since the renderers don't currently pay attention to DPI, this will result in the image being three times the intended size.  To account for this, you'll need to set the Sizing property of your generated image to FitProportional so that the image is rendered at its originally intended size:

m_MyImage.Sizing = Microsoft.ReportingServices.ReportRendering.Image.Sizings.FitProportional;

In some future version when we add native vector graphics support (EMF or SVG), this will become a non-issue for custom report items.  At that time, a CRI could generate a single vector image which would be automatically converted by the Rendering Object Model into a raster image of appropriate DPI if only raster images are supported by the target renderer.

I've attached an updated Custom Report Item sample which illustrates working with variable DPI.

PolygonsCRI.zip