简体   繁体   English

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

[英]Rendering barcodes in PDF export from Microsoft.ReportViewer.LocalReport

I am using Microsoft.Reporting.WebForms namespace and trying to render the data from my localreport object for printing purposes on the client side. 我正在使用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

The output pdf file is displaying little boxes instead of barcodes. 输出pdf文件显示的是小方框而不是条形码。 It appears that pdf can't support code128 font. 看来pdf不能支持code128字体。

Things I've tried: 我试过的事情:

  • Tried other file formats: "Image" is rendering but is too blurry. 尝试过其他文件格式:“图像”正在渲染,但过于模糊。 "WORD" breaks the report design and margins. “WORD”打破了报告的设计和利润。
  • Installed the font on both the server my app is on and client 在我的应用程序所在的服务器和客户端上安装了该字体
  • giving parameters to render method 为render方法提供参数

PS: PS:

The built in exportReport method from the client side exports the pdf perfectly with sharp barcodes. 来自客户端的内置exportReport方法使用尖锐的条形码完美地导出pdf。 But I am trying to render the data and return it as byte array. 但我试图渲染数据并将其作为字节数组返回。 I couldn't figure out the difference between this client side method and server side render method. 我无法弄清楚这个客户端方法和服务器端渲染方法之间的区别。 Do they use different logic? 他们使用不同的逻辑吗?

I would appreciate if you can direct me in some direction. 如果你能指导我某个方向,我将不胜感激。

Thanks. 谢谢。

It seems that this was a known bug with Microsoft Reporting Services 10.0.0. 这似乎是Microsoft Reporting Services 10.0.0的一个已知错误。 After much googling, I stopped and checked my referenced files. 经过大量的谷歌搜索,我停下来检查我的引用文件。 It turns out that I was referencing version 10 of Microsoft.Reporting.WebForms although in my other project that worked it was version 11. So if anyone runs into the same problem, just make sure that you are not using the version 10 dll files. 事实证明,我正在引用Microsoft.Reporting.WebForms第10版,尽管在我的其他项目中它是版本11.因此,如果有人遇到同样的问题,请确保您没有使用版本10 dll文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM