3
votes

I am generating a report through RDLC file. I have some charts in my report with bar charts. When I export the report to PDF, the resolution of the chart is pretty bad and the bar charts get pixelated. Is it possible to define a higher resolution of PDF for reports running in local mode in RDLC?

I found this link that says that pdf generated through ReportServer can be given a higher resolution. But I cannot find this configuration file anywhere. http://msdn.microsoft.com/en-us/library/ms154682.aspx

Is it a limitation of RDLC files? Is it feasible for RDLC files?

Thank you!

3

3 Answers

2
votes

I found out a workaround for this issue. It may not be possible to change the dpiX and dpiY of PDF through reportviewer settings, but we can do so by manually exporting or rendering the pdf through C#. The Report.Render() does this and uses dpiX and dpiY value in the <deviceinfo> parameter of its XML. Here is the code that does this:

        string reportype = "PDF";
        string mimeType;
        string encoding;
        string fileNameExtension;

        string devinfo = "<DeviceInfo><ColorDepth>32</ColorDepth><DpiX>350</DpiX><DpiY>350</DpiY><OutputFormat>PDF</OutputFormat>"+
        "  <PageWidth>8.5in</PageWidth>" +
         "  <PageHeight>11in</PageHeight>" +
         "  <MarginTop>0.5in</MarginTop>" +
         "  <MarginLeft>0.5in</MarginLeft>" +
          "  <MarginRight>0in</MarginRight>" +
          "  <MarginBottom>0in</MarginBottom>" +
        "</DeviceInfo>";

        Warning[] warnings;
        string[] streams;
        byte[] renderedBytes;

        renderedBytes = this.reportViewer1.LocalReport.Render(reportype, devinfo, out mimeType,

    out encoding,

    out fileNameExtension,

    out streams,

    out warnings);

        using (FileStream fs = new FileStream("output3.pdf", FileMode.Create))
        {
            fs.Write(renderedBytes, 0, renderedBytes.Length);
        }
1
votes

Those settings can be changed in the rsreportserver.config, look the one that belongs to your report server instance.

Examples here: http://technet.microsoft.com/en-us/library/ms156281.aspx

Hope that helps you.

-2
votes

Charts in PDF export are bitmaps exported to PDF. You may not be able to control them much using RDLC. With RDLs, you may have extra control using DeviceInfo though.

Correction : I was under impression that Device info could not be set for RDLC but of course i was wrong. Did a quick look up and found these possible device info settings for PDF renderer