I have used SP1 successfully to render a CCITT G4 compression report through the web viewer. But now when I automate it through code to churn out many reports in an automated fashion is goes back to LZW compression which is not what I want. Here is what i have in my code....please help! Am I formatting my extension wrong or feeding variables to the Render method incorrectly. The DPI changes but the compression stays as LZW. Thanks in advance for your help.
Doug
string mimType = string.Empty; | |
string extension = string.Empty; | |
Encoding encoding = null; | |
Report1 report1 = new Report1(); | |
Hashtable deviceInfo = new Hashtable(); | |
deviceInfo["OutputFormat"] = "TIFF"; | |
deviceInfo["TiffCompression"] = "ccitt4"; | |
deviceInfo["DpiX"] = 300; | |
deviceInfo["DpiY"] = 300; | |
byte[] buffer = Telerik.Reporting.Processing.ReportProcessor.Render( | |
"TIFF300", report1, deviceInfo, out mimType, out extension, out encoding); | |
using (MemoryStream stream = new MemoryStream(buffer)) | |
{ | |
using (System.Drawing.Image img = System.Drawing.Image.FromStream(stream)) | |
{ | |
img.Save(@"c:\temp\" + report1.GetType().Name + "." + extension, | |
System.Drawing.Imaging.ImageFormat.Tiff); | |
} | |
} |
My extension in the web.config look like this....
<Extension name="TIFF_CCITT4_300" |
type="Telerik.Reporting.ImageRendering.ImageReport, Telerik.Reporting.Processing, Version=2.0.1.0, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" |
description="TIFF file (CCITT Group 4 300dpi)"> |
<Parameters> |
<Parameter name="TiffCompression" value="ccitt4" /> |
<Parameter name="DpiX" value="300" /> |
<Parameter name="DpiY" value="300" /> |
</Parameters> |
</Extension> |
<Extension name="TIFF300" |
type="Telerik.Reporting.ImageRendering.ImageReport, Telerik.Reporting.Processing, Version=2.0.1.0, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" |
description="TIFF file (CCITT Group 4 300dpi)"> |
<Parameters> |
<Parameter name="TiffCompression" value="ccitt4" /> |
<Parameter name="DpiX" value="300" /> |
<Parameter name="DpiY" value="300" /> |
</Parameters> |
</Extension> |