0

All:

Here is the information about my Web Application development environment:

-Microsoft Visual Studio Professional 2013

-.NET Framework 4.0

I've installed the following:

-Microsoft Report Viewer 2012 Runtime

-Microsoft Report Viewer 2010 SP1 WebForms

-jqPlot Charts version: 1.0.8 revision: 1250

For the application that we develop at work, we are able to generate a Graph using jqPlot.

jqPlot will place the graph that is generated in the following div section within an ASPX page:

<div id="chartdiv" ></div>

However, one of the requirements for the project is to ensure that the graph can also be placed in PDF file if the user wants to generate a pdf using Microsoft ASP.NET Report Definition Language Client-side (rdlc) and Microsoft ReportViewer technology.

1) Would it be possible to some how directly you get the jqPlot graph as an image into a pdf file?

If no, I have figured out how to make use of jqPlot's API to create an image in another div section of the same ASPX page.

I just wanted to briefly describe the code:

  <div id="chartdiv" ></div>


  var imgelem = $('#chartdiv').jqplotToImageElem();

2) Is it possible to send the imgelem variable which references an image to the Microsoft ReportViewer rdlc file? If yes, could someone please give me a high-level stepy-by-step plan as to how I should go about implementing such a feature?

CS Lewis
  • 489
  • 8
  • 30

1 Answers1

1

Take a look at this article:

http://www.aspsnippets.com/Articles/Dynamically-add-and-display-external-Image-in-RDLC-Report-from-code-behind-in-ASPNet.aspx

It is possible to inject an image by passing it reportParameter to your report viewer:

    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
    ReportViewer1.LocalReport.EnableExternalImages = true;
    string imagePath = new Uri(Server.MapPath("~/images/Mudassar.jpg")).AbsoluteUri;
    ReportParameter parameter = new ReportParameter("ImagePath", imagePath);
    ReportViewer1.LocalReport.SetParameters(parameter);
    ReportViewer1.LocalReport.Refresh();
meda
  • 45,103
  • 14
  • 92
  • 122