reporting-servicesssrs-2008rendering-engine

Has anyone figured out a way to render a Reporting Services report at a resolution greater than 96ppi?


I've tried everything I can think of to change the rendering parameters for a report that I need to render as a 300ppi TIFF.

Here's one of several attempts using the URL approach. As we went from 96ppi to 300ppi the size of the 8.5 x 11 image increases dramatically, but the resolution remainded at 96ppi.

//s0550284/ReportServer?/ERecordingReports/Report1&rs:Format=IMAGE&rc:DpiX=300&rc:DpiY=300&rc:PageHeight=11in&rc:PageWidth=8.5in&rs:Command=Render

We've tried changing the SSRS configuration files to change the default from 96ppi to 300ppi, but the change is ignored.

It's starting to look like someone hardcoded 96ppi somewhere where it can't be overridden.

We're running SQL Server 2008 R2.

Any thoughts about how to get past this problem would be very much appreciated.

-Tom


Solution

  • With the assistance of respondants here and in other forums, I found a simple hack that seems to solve my problem. It came to me after I gave up the fight with SSRS. I'm sure that there are lots of perfectly valid reasons as to why SSRS handles different resolution parameters as it does. Frankly, I don't give a hoot. I just need my document generated at the size and resolution I specified.

    Here's the relevant pieces of code (error handling removed for the sake of brevity). I invoke SSRS via the web service interface, generate the report, and render it as 300 x 300 TIFF. The results are temporarily saved. It will have been generated as a 96ppi TIFF and scaled up. I then read it in into a BitMap, change the resolution to 300 x 300, and write it back out again. Done.

    string deviceInfo = "<DeviceInfo> <OutputFormat>TIFF</OutputFormat> <DpiX>300</DpiX> <DpiY>300</DpiY> <PrintDpiX>300</PrintDpiX> <PrintDpiY>300</PrintDpiY> </DeviceInfo>";
    string format = "IMAGE";
    Byte[] results;
    string mimeType = "image/tiff";
    
    // Generate the report as a TIF
    ExecutionInfo ei = new ExecutionInfo();
    ei = rsExec.LoadReport(_reportName, historyID);
    results = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
    
    string TempFileRSGeneratedTIFF = TempPath + "RSGeneratedTIFF.TIF";
    
    // Save tiff file returned by RS
    using (FileStream stream = File.OpenWrite(TempFileRSGeneratedTIFF))
    {
        stream.Write(results, 0, results.Length);
    }
    
    // Read tif file into bitmap
    Bitmap image = new Bitmap(TempFileRSGeneratedTIFF);
    
    // Change the resolution to what it was supposed to be in the first place..
    image.SetResolution(300, 300);
    
    // Save the final version of the file
    image.Save(DestFileName, System.Drawing.Imaging.ImageFormat.Tiff);
    
    image.Dispose();