I have a report that I need to run multiple times and save as PDFs. I am currently generating the report as a PDF programatically but want to save the reports without the user having to choose the save option manually each time.
The code I use to render a single report as a PDF is:
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim deviceInfo As String
Dim bytes As Byte()
Dim lr As New Microsoft.Reporting.WebForms.LocalReport
deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"
bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, mimeType, encoding, extension, streamids, warnings)
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.BinaryWrite(bytes)
Response.Flush()
Response.Close()
I was figuring I could run it in a loop and save the PDF each time.