从Microsoft.ReportViewer.LocalReport中导出PDF导出中的条形码

时间:2017-02-03 13:12:04

标签: c# asp.net pdf render reportviewer

我正在使用Microsoft.Reporting.WebForms命名空间并尝试从我的localreport对象呈现数据,以便在客户端进行打印。

byte[] bytes = myReportViewer.LocalReport.Render("PDF");
File.WriteAllBytes("test.pdf", bytes); // I will normally return bytes here but for testing I am writing to a file

输出pdf文件显示的是小方框而不是条形码。看来pdf不支持 code128 字体。

我尝试过的事情:

  • 尝试过其他文件格式:"图片"正在渲染,但太模糊了。 " WORD"打破报告设计和利润。
  • 在我的应用程序所在的服务器和客户端
  • 上安装了该字体
  • 为渲染方法提供参数

PS:

来自客户端的内置exportReport method使用尖锐的条形码完美地导出pdf。但我试图渲染数据并将其作为字节数组返回。我无法弄清楚这个客户端方法和服务器端渲染方法之间的区别。他们使用不同的逻辑吗?

如果你能指导我某个方向,我将不胜感激。

感谢。

1 个答案:

答案 0 :(得分:0)

这似乎是Microsoft Reporting Services 10.0.0的一个已知错误。经过大量的谷歌搜索,我停下来检查我的引用文件。事实证明我引用了Microsoft.Reporting.WebForms的第10版,尽管在我的其他项目中它是版本11。 因此,如果有人遇到同样的问题,请确保您没有使用版本10 dll文件。