Free Support Forum - aspose.com

Running ad Printing an SSRS Report

Hi All,

We have 2 SSRS reports built for our customer. Or requirement is to provide a print button on each individual applicant record which should run the reports in real time for that selected application(Application Id is input paramter for report) and then send to printer.

Can you please provide any example of doing the operation through Aspos Reporting service extension?

Also can the report be directly sent to printer after it has run, or does it have to be converted to any format such as PDF before sending to printer? Our customer just requires report running and printing functionality.

Thanks

Hi Umer,


Thanks for contacting support.

Aspose.Pdf for Reporting Services can be used to render .RDL reports to PDF format and then PdfViewer presnet inside Aspose.Pdf.Facades namespace of Aspose.Pdf for .NET provides the capability to print the PDF documents. So as per your requirement, you can use Aspose.Pdf for Reporting Services and Aspose.Pdf for .NET in Visual Studio project and convert .RDL file to PDF format and then print the document using PdfViewer class.

Please try using the attached sample project which illustrates the above stated behavior. In order to test the project without any issues, please make following changes in project.

  • Update Aspose.Pdf for Reporting Services license path information inside RenderWithAsposePdf(…) method.
  • Update Aspose.Pdf for .NET license path information inside PrintPdfFile(…) method.
  • Update the path information for printout inside PrintPdfFile(…) method (if necessary).
  • You may consider updating the path of output generated with Aspose.Pdf for Reporting Services inside Form1(…) method.
  • Specify the path of source/input .RDL file. See attached image file.

Project is tested with Aspose.Pdf for Reporting Services 2.5.3 and Aspose.Pdf for .NET 8.4.0 in Visual Studio 2010 application running over Windows 7 (x64) containing SQL Reporting Services 2008. In case you encounter any issue or you have any further query, please feel free to contact.

Thanks.My SSRS report takes one input parameter before running the report which is the record id, question is how do i specify that input parameter through code?

In our case, Report(i.e. rdl) is stored on reporting server DB therefore is therefore any other way of specifiying rdl location other then physical disc?

Also we don't want to save the converted pdf on disc , we just need to store it as pdf attachment in db against that record.

This code will be running from .net class library therefore how do i apply license within .net class library code as this will be registered in DB and therefore won't be able to access any file from disc.

Regards

Umer

Nayyer,

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 attached to there business object as 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 report as pdf with our business object(i.e. with an entity in our dynamics CRM application).

I also need to know how to specifiy input parameter through code?

Do you have any example of achieving above?(i.e. running report from class library then building a pdf in memory which i could use then to attach with our business object)

Or am i correct that execution of report is not supported through your product in .net class library project?

Apologies for pushing for answers but i really need to know ASAP before i could ask customer to spend 6000+ dollars as if it is the right product.

Thanks

Umer

Umer Javed:
eThanks.My SSRS report takes one input parameter before running the report which is the record id, question is how do i specify that input parameter through code?
Hi Umer,

You can also accept the input parameter from user from text field over Form. Furthermore, please note that Aspose.Pdf for Reporting Services also supports rendering parameters when rendering the report. For further information, please visit Configure Aspose.Pdf for Reporting Services

Umer Javed:
In our case, Report(i.e. rdl) is stored on reporting server DB therefore is therefore any other way of specifiying rdl location other then physical disc?
The ReportViewer control accepts path to reports stored over Report Server or the file stored over local system and in order load the file stored in DB, you can temporary create the file over system and perform the conversion.

Umer Javed:
Also we don’t want to save the converted pdf on disc , we just need to store it as pdf attachment in db against that record.
Once the conversion is performed, instead of saving the output over system, you can save the output in Stream object and save it into DB. The renderer.FinishRendering(pptSteam); method accepts Stream object as an argument so instread of passing FileStream object, you can use MemoryStream object.

Umer Javed:
This code will be running from .net class library therefore how do i apply license within .net class library code as this will be registered in DB and therefore won’t be able to access any file from disc.
The SetLicense(…) method also supports Stream object as argument so you can load the license file into Stream object and pass the stream to initialize the license.

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 attached to there business object as 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 report as pdf with our business object(i.e. with an entity in our dynamics CRM application).

I also need to know how to specifiy input parameter through code?

Hi Umer,


Thanks for your patience.


Besides adding ReportViewer control in your application and displaying the report over the 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 which you need to convert, please try using following code lines

[C#]

exportButton.Click += new
System.EventHandler((s, e) =><o:p></o:p>

{<o:p></o:p>

// specify the path of report which you
need to render as PDF format
<o:p></o:p>

reportViewer1.LocalReport.ReportPath = “c:/pdftest/local_city_SanDiego.rdl”;<o:p></o:p>

// save the output from Aspose.Pdf for
Reporting Services
<o:p></o:p>

Form1.RenderWithAsposePdf(this.reportViewer1,
“c:/pdftest/ReportViewer_Output.pdf”);

});

Umer Javed:
Do you have any example of achieving above?(i.e. running report from 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 project shared earlier in 496108 post.

Umer Javed:
Or am i correct that execution of report is not supported through your product in .net class library project?
Please try using the solution earlier as it explains the steps on how to load .RDL file, transform it to PDF format and then print the file.