SSRS: How to print a report without bringing up the rendered report?

I'm wondering how to print a SSRS report without bringing up a report viewer. Right now my users have to press the Print button, bring up the rendered report, and then press Print again.

Current Code:

Dim report as new ReportViewer 'snip - fill datasets, set data sources, blah blah blah report.ReportViewer1.LocalReport.DataSources.Add(datasource) report.Show()

This brings up a viewer window, which I don't really want, since my users then have to press Print again.

So I added the following:

report.PrintDialog()

The above code results in an invalidOperationException because it hasn't finished rendering. I understand that, but is there a way to render the report programmatically (rather than onscreen) and send the user straight to the printer dialogue?

EDIT: OK, I'm 90% there. PrintDialog() isn't the way to go. I found this article but it results in an InvalidXMLException. It doesn't tell me why it's wrong, just that it's wrong... The API is totally unhelpful so... help?

-------------Problems Reply------------

You could use the SSRS Web Service to programmatically render the report (i.e. as a PDF) and then print it from your application.

http://msdn.microsoft.com/en-us/library/ms152952.aspx

Here's what I found on the subject, followed, and worked for me: http://printssrsreport.blogspot.com/2011/09/print-ssrs-report-using.html

It's important you follow "Step 1" and add the reference to "ReportExecution2005.asmx". This was confusing to me as I am using Reporting Services 2008 R2. But it is what it is, and it works.

The rest should be straight forward and work for you.

Why not just put the reports on a schedule, get them to save as a pdf to a folder then use something like Batch print pro to print them?

Category:.net Views:1 Time:2011-04-26

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.211 (s). 11 q(s)