【问题标题】:SSRS report streamed as image and printed doesnt match PDF export作为图像流式传输的 SSRS 报告和打印与 PDF 导出不匹配
【发布时间】:2017-08-29 18:15:52
【问题描述】:

我们有一个客户端,它将 SSRS 报告流式传输到两个应用程序中,一个是控制台,另一个是 WinForms 应用程序。控制台应用程序自动为用户生成最新报告,并可选择将相同的报告自动打印到默认选择的打印机。将报告导出为 PDF 时,报告看起来很完美,但是当自动打印报告时,文本大小似乎会略微缩小,文本间距会减小,并且与自动生成的 PDF 相比,某些位置会有所不同。

当自动打印报告时,我们将报告作为图像流式传输,然后创建自定义 PrintPage 方法来创建矩形,然后将图像设置在矩形内,然后将图像发送到打印(参见下面的代码)。

private void PrintPage(object sender, PrintPageEventArgs ev)
    {

        var pageImage = new Metafile(_mStreams[_currentPageIndex]);

        // Adjust rectangular area with printer margins.
        var adjustedRect = new Rectangle(
            ev.PageBounds.Left - (int)ev.PageSettings.HardMarginX,
            ev.PageBounds.Top - (int)ev.PageSettings.HardMarginY,
            ev.PageBounds.Width,
            ev.PageBounds.Height);

        // Draw a white background for the report
        ev.Graphics.FillRectangle(Brushes.White, adjustedRect);

        // Draw the report content
        ev.Graphics.DrawImage(pageImage, adjustedRect);

        // Prepare for the next page. Make sure we haven't hit the end.
        _currentPageIndex++;
        ev.HasMorePages = (_currentPageIndex < _mStreams.Count);

    }

页面的边距和大小在该过程完成时匹配,但显然自动打印副本上的文本显示方式存在差异。下面是两个报告的屏幕截图,您可以在其中看到一些文本的间距和位置与自动生成的 PDF 报告略有不同。当自动生成的 PDF 包含比图像导出多几页的 50 多页文档时,此问题对报告的影响更大。

自动生成的屏幕截图

自动打印屏幕截图

非常感谢您对此的任何帮助,谢谢。

【问题讨论】:

    标签: c# .net reporting-services webforms console-application


    【解决方案1】:

    因此,我放弃了旧的打印功能,转而使用 Adob​​e 自动打印最近生成的报告,从而使其恢复工作。我的问题的症结在于将报告重新导出为来自 SSRS 的图像。这会导致所有格式和样式都进行调整以匹配该格式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多