Reporting services 是否有人找到了一种以大于96ppi的分辨率呈现Reporting Services报告的方法?

Reporting services 是否有人找到了一种以大于96ppi的分辨率呈现Reporting Services报告的方法?,reporting-services,ssrs-2008,rendering-engine,Reporting Services,Ssrs 2008,Rendering Engine,我已经尝试了所有我能想到的方法来更改我需要以300ppi TIFF格式呈现的报告的呈现参数 下面是使用URL方法的几种尝试之一。当我们从96ppi增加到300ppi时,8.5x11图像的大小急剧增加,但分辨率保持在96ppi //s0550284/ReportServer?/ERecordingReports/Report1&rs:Format=IMAGE&rc:DpiX=300&rc:DpiY=300&rc:PageHeight=11in&rc:Page

我已经尝试了所有我能想到的方法来更改我需要以300ppi TIFF格式呈现的报告的呈现参数

下面是使用URL方法的几种尝试之一。当我们从96ppi增加到300ppi时,8.5x11图像的大小急剧增加,但分辨率保持在96ppi

//s0550284/ReportServer?/ERecordingReports/Report1&rs:Format=IMAGE&rc:DpiX=300&rc:DpiY=300&rc:PageHeight=11in&rc:PageWidth=8.5in&rs:Command=Render
我们已尝试更改SSRS配置文件,将默认值从96ppi更改为300ppi,但更改被忽略

它开始看起来像是某个硬编码96ppi的人,在某个地方它无法被覆盖

我们正在运行SQL Server 2008 R2

任何关于如何克服这个问题的想法都将不胜感激


-汤姆

在这里和其他论坛的响应者的帮助下,我发现了一个简单的破解方法,似乎可以解决我的问题。在我放弃与SSR的战斗后,我想到了这一点。我相信有很多非常有效的理由可以解释为什么SSRS会处理不同的分辨率参数。坦白说,我一点也不在乎。我只需要按照我指定的大小和分辨率生成文档

以下是相关的代码片段(为了简洁起见,删除了错误处理)。我通过web服务接口调用SSRS,生成报告,并将其呈现为300 x 300 TIFF。结果将临时保存。它将被生成为96ppi TIFF并按比例放大。然后我将其读入位图,将分辨率更改为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();
string deviceInfo=“TIFF 300”;
字符串格式=“图像”;
字节[]结果;
字符串mimeType=“image/tiff”;
//将报告生成为TIF
ExecutionInfo ei=新的ExecutionInfo();
ei=rsExec.LoadReport(_reportName,historyID);
结果=rsExec.Render(格式、设备信息、输出扩展名、输出编码、输出mimeType、输出警告、输出streamid);
字符串TempFileRSGeneratedTIFF=TempPath+“RSGeneratedTIFF.TIF”;
//保存由RS返回的tiff文件
使用(FileStream stream=File.OpenWrite(TempFileRSGeneratedTIFF))
{
stream.Write(results,0,results.Length);
}
//将tif文件读入位图
位图图像=新位图(tempfilersgeneratedtif);
//将决议更改为最初的设想。。
图像分辨率(300300);
//保存文件的最终版本
image.Save(DestFileName,System.Drawing.Imaging.ImageFormat.Tiff);
image.Dispose();

通过编辑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>

TIFF 200 DPI
32
200
200
蒂芙
TIFF 300 DPI
32
300
300
蒂芙

请注意,我保留了原始图像扩展的完整性(尽管我不必这样做),并为该扩展添加了两个引用-一个是200 DPI,另一个是300 DPI。这三个选项现在都显示在报表管理器的“导出”下拉列表中,并且可以正常工作。请注意(通过遵循Micorsoft的示例),我包含了ColorDepth属性,尽管SSRS会忽略它。还要注意,我在Name属性中使用了Language参数。我在看的那篇文章说,如果覆盖配置不包含语言参数(没有测试它),它将被忽略。

在配置文件中进行更改后,尝试重新启动ReportServer。点击下面的链接


导出图像后,我不确定是否要尝试更改分辨率。

将图像对象设置为外部(报表服务器上的链接)或数据库中,而不是嵌入报表中。

我尝试了@Chuck Brevitt的方法,但是来自Web API的报告服务似乎并不尊重PDF设置的DPI设置。 通过实验和Microsoft notes中的一些提示,我发现这是有效的:

为了获得更好的图像PDF呈现,请按如下方式传递设备信息:

http://serverName/ReportServer?/pathtoReport/ReportName&InvoiceIdOrOtherParameter=24013&rs:Command=Render&rs:Format=PDF&rs:DeviceInfo=<DpiX>300<%2FDpiX><DpiY>300<%2FDpiY>
http://serverName/ReportServer?/pathtoReport/ReportName&InvoiceIdOrOtherParameter=24013&rs:Command=Render&rs:Format=PDF&rs:DeviceInfo=300300

我为SSRS 2012在阳光下尝试了一切,我指的是一切。但最终我也放弃了。就像我发现的汤姆和谷歌搜索一样

这是工作模式:

public static string BumpUpResolution(string filename, float dpiX, float dpiY, string processID)
    {
        int oldWidth = 0, oldHeight = 0;

        Bitmap image = new Bitmap(filename);
        oldWidth = image.Width;
        oldHeight = image.Height;

        using (Bitmap bm = new Bitmap(oldWidth, oldHeight))
        {
            Point[] points = {
                             new Point(0,0),
                             new Point(oldWidth, 0),
                             new Point(0, oldHeight),
                         };

            using (Graphics gr = Graphics.FromImage(bm))
            {
                gr.DrawImage(image, points);
            }

            bm.SetResolution(dpiX, dpiY);

            bm.Save(Path.Combine(Path.GetDirectoryName(filename), string.Format("{0}{1}", processID, Path.GetExtension(filename))), System.Drawing.Imaging.ImageFormat.Tiff);
        }

        image.Dispose();
        return Path.Combine(Path.GetDirectoryName(filename), string.Format("{0}{1}", processID, Path.GetExtension(filename)));
    }

查看帮助中提到的未记录的PrintDpiX/Y设置是否存在。我这里没有本地的SSRS 2008服务器设置,所以我自己无法检查它是否有任何用处,但也许它会让你在这个问题上取得一些进展。Tim-那里有一些有趣的分析(它们有点相切),但它似乎并没有真正解决问题。谢谢大家!-汤姆:你可能想退房。它并没有给你答案,但它确实展示了有人是如何为非HTML渲染的图像提供300 dpi的。我通过实验和Microsoft的一些非常糟糕的文档发现,正确的方法不是rc:DpiX,而是如下所示:&rs:DeviceInfo=300300请参阅下面的文章。这比公认的答案简单得多。您好,您如何指定在报表中使用此扩展名?我有一张从表中的数据库中拍摄的图像,但我不知道如何强制将图像渲染为tiff 200 dpi。非常感谢。很不错的。我们正在运行SSRS 2016,我不必重新启动服务。更改是即时的,我可以从“导出”下拉列表中选择扩展。虽然这样做有效,但我确实发现有一种方法可以在Url中传递DpiX和DpiY参数,这要简单得多。见下面我的帖子。