有没有人想出一种以高于96ppi的分辨率呈现Reporting Services报告的方法?

tom*_*tom 5 rendering-engine reporting-services ssrs-2008

我已经尝试了一些我能想到的更改报表的渲染参数,我需要将其呈现为300ppi TIFF.

这是使用URL方法的几次尝试之一.当我们从96ppi变为300ppi时,8.5 x 11图像的大小显着增加,但分辨率仍然保持在96ppi.

//s0550284/ReportServer?/ERecordingReports/Report1&rs:Format=IMAGE&rc:DpiX=300&rc:DpiY=300&rc:PageHeight=11in&rc:PageWidth=8.5in&rs:Command=Render
Run Code Online (Sandbox Code Playgroud)

我们已尝试更改SSRS配置文件以将默认值从96ppi更改为300ppi,但忽略更改.

它开始看起来像某个硬编码的96ppi,它无法被覆盖.

我们正在运行SQL Server 2008 R2.

任何关于如何解决这个问题的想法都将非常感激.

-Tom

tom*_*tom 8

在这里和其他论坛的响应者的帮助下,我发现了一个简单的黑客,似乎可以解决我的问题.在我放弃与SSRS的斗争后,它来到我身边.我确信SSRS处理不同分辨率参数的原因有很多完全正确的理由.坦率地说,我不会发出声音.我只需要以我指定的大小和分辨率生成我的文档.

这是相关的代码片段(为简洁起见,删除了错误处理).我通过Web服务接口调用SSRS,生成报告,并将其呈现为300 x 300 TIFF.结果暂时保存.它将以96ppi TIFF生成并按比例放大.然后我将其读入BitMap,将分辨率更改为300 x 300,然后再将其写回.完成.

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();
Run Code Online (Sandbox Code Playgroud)


小智 5

通过编辑rsreportserver.config文件,可以在SSRS 2008 R2中轻松完成此操作:

      <Extension Name="IMAGE" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering" />
  <Extension Name="TIFF 200 DPI" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering">
    <OverrideNames>
      <Name Language="en-US">TIFF 200 DPI</Name>
    </OverrideNames>
    <Configuration>
      <DeviceInfo>
        <ColorDepth>32</ColorDepth>
        <DpiX>200</DpiX>
        <DpiY>200</DpiY>
        <OutputFormat>TIFF</OutputFormat>
      </DeviceInfo>
    </Configuration>
  </Extension>
  <Extension Name="TIFF 300 DPI" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering">
    <OverrideNames>
      <Name Language="en-US">TIFF 300 DPI</Name>
    </OverrideNames>
    <Configuration>
      <DeviceInfo>
        <ColorDepth>32</ColorDepth>
        <DpiX>300</DpiX>
        <DpiY>300</DpiY>
        <OutputFormat>TIFF</OutputFormat>
      </DeviceInfo>
    </Configuration>
  </Extension>
Run Code Online (Sandbox Code Playgroud)

请注意,我保留了原始的IMAGE扩展名(尽管我没有必要),并添加了对该扩展名的另外两个引用-一个引用为200 DPI,另一个引用为300 DPI。这三个现在都显示在报表管理器的导出下拉列表中,并且可以正常工作。请注意,(按照Micorsoft的示例)我包括了ColorDepth属性,尽管SSRS忽略了它。还要注意,我在Name属性中使用了Language参数。我正在看的文章说,如果重写配置不包含Language参数(未对其进行测试),它将被忽略。