Umer Javed:
Further to my questions, I don’t want to run the report from ReportViewer as my customer’s requirement is not to view the reports instead run upon button click and attach to their business object as a PDF after execution and then send to printer for printing.
I have a class library project which will execute the report and at run time, build and attach the output of the report as a PDF with our business object (i.e., with an entity in our dynamics CRM application).
I also need to know how to specify input parameters through code?
Hi Umair,
Thanks for your patience.
Besides adding ReportViewer control in your application and displaying the report over a form object, you can load the .RDL file programmatically, use the same report, transform it to PDF format using Aspose.Pdf for Reporting Services, save the output and use Aspose.Pdf for .NET to print the output.
In order to specify the .RDL file that you need to convert, please try using the following code lines:
exportButton.Click += new
System.EventHandler((s, e) => {
// specify the path of report which you
// need to render as PDF format
reportViewer1.LocalReport.ReportPath = "c:/pdftest/local_city_SanDiego.rdl";
// save the output from Aspose.Pdf for Reporting Services
Form1.RenderWithAsposePdf(this.reportViewer1,
"c:/pdftest/ReportViewer_Output.pdf");
});
Umer Javed:
Do you have any example of achieving the following? (i.e., running the report from a class library, then building a PDF in memory which I could use, then to attach with our business object)
In order to accomplish this requirement, please try using MemoryStream instead of FileStream object in RenderWithAsposePdf(…) method of the project shared earlier in link.
Umer Javed:
Or am I correct that the execution of the report is not supported through your product in a .NET class library project?
Please try using the solution mentioned earlier as it explains the steps on how to load .RDL file, transform it to PDF format, and then print the file.