Okan Konur Okan Konur - 4 years ago 210
ASP.NET (C#) Question

Rendering barcodes in PDF export from Microsoft.ReportViewer.LocalReport

I am using

namespace and trying to render the data from my localreport object for printing purposes on the client side.

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. It appears that pdf can't support code128 font.

Things I've tried:

  • Tried other file formats: "Image" is rendering but is too blurry. "WORD" breaks the report design and margins.

  • Installed the font on both the server my app is on and client

  • giving parameters to render method


The built in exportReport method from the client side exports the pdf perfectly with sharp barcodes. 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.


Answer Source

It seems that this was a known bug with 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download