Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 540125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:12:28+00:00 2026-05-13T10:12:28+00:00

I have a report that I need to run multiple times and save as

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:12:28+00:00Added an answer on May 13, 2026 at 10:12 am

    What’s your question in here? Is it that it does not work?

    here is an example of something we didin 2005. We defined a control called rptViewer1 which can be visible or not depending of your needs. strFormat should contain “PDF” and strNomFicher the full path.

    BTW the variable names and functions are in french, but that will work anyway 🙂

    
        Public Sub CreerFichierRapport(ByVal strNomFichier As String, ByVal strFormat As String)
            Dim bytes() As Byte
            Dim strDeviceInfo As String = ""
            Dim strMimeType As String = ""
            Dim strEncoding As String = ""
            Dim strExtension As String = ""
            Dim strStreams() As String
            Dim warnings() As Warning
            Dim oFileStream As FileStream
            _stream = New List(Of Stream)
            Try
                bytes = rptViewer1.LocalReport.Render(strFormat, strDeviceInfo, strMimeType, strEncoding, strExtension, strStreams, warnings)
    
                oFileStream = New FileStream(strNomFichier, FileMode.Create)
                oFileStream.Write(bytes, 0, bytes.Length)
                _stream.Add(oFileStream)
            Finally
                If Not IsNothing(oFileStream) Then
                    oFileStream.Close()
                    oFileStream.Dispose()
                End If
            End Try
        End Sub
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of reports that need to be both run separately and
I have a number of reports that I run against my database that need
I have a complicated report that I need to draw with GDI+ (I don't
I have a report that I'm exporting to PDF using the VS2008 version of
I have a reasonably long SQL query that I need to run in a
I have a report that I need to export to a csv file for
I have a report that contains a pie chart within it. I would want
I need some clarification. I have a Reportwriter dll that uses Crystal Reports. It
I have a report that is returning a one data field to a tablix
I have a report that I created in SQL Server Reporting Services 2008. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.