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 261777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:27:37+00:00 2026-05-11T22:27:37+00:00

Ok, so i am working on exporting my SSRS 2008 Reports to an image.

  • 0

Ok, so i am working on exporting my SSRS 2008 Reports to an image. What I would like to do is Export each individual page as an image. From my code, I can only get it to export the first page of the report. Any help would greatly be appreciated.

    Dim warnings As Microsoft.Reporting.WebForms.Warning()
    Dim streamids As String()
    Dim mimeType, encoding, extension As String

    Dim deviceInfo As XElement = _
      <DeviceInfo>
          <OutputFormat>JPEG</OutputFormat>
      </DeviceInfo>

    Report.ServerReport.SetParameters(Parameters)
    Dim bytes As Byte() = Report.ServerReport.Render("Image", deviceInfo.ToString(), mimeType, encoding, extension, streamids, warnings)

    Dim FileStream As New MemoryStream(bytes)
    Dim ReportImage As New System.Drawing.Bitmap(FileStream)

    ReportImage.Save(Server.MapPath("/Testing.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg)
  • 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-11T22:27:37+00:00Added an answer on May 11, 2026 at 10:27 pm

    in one of my projects I use the following code to obtain one stream per page. Unfortunately I don’t use VB.NET, but you should be able to translate this from C# to VB. Note: This works on SSRS2005 – I’m not sure it also works for SSRS2008! Also, I’m using the code to directly print the report without having to use the report viewer, so I’m creating an EMF device info – you might have to change this.

    This base code was found somewhere on the Web after Googling for hours – I’d like to credit the author, but I didn’t bookmark the link – sorry.

    CultureInfo us = new CultureInfo("en-US");
    string deviceInfo = String.Format(
          "<DeviceInfo>" +
          "  <OutputFormat>EMF</OutputFormat>" +
          "  <PageWidth>{0}cm</PageWidth>" +
          "  <PageHeight>{1}cm</PageHeight>" +
          "  <MarginTop>{2}cm</MarginTop>" +
          "  <MarginLeft>{3}cm</MarginLeft>" +
          "  <MarginRight>{4}cm</MarginRight>" +
          "  <MarginBottom>{5}cm</MarginBottom>" +
          "</DeviceInfo>",
          Math.Round(m_pageSize.Width, 2).ToString(us),
          Math.Round(m_pageSize.Height, 2).ToString(us),
          Math.Round(m_marginTop, 2).ToString(us),
          Math.Round(m_marginLeft, 2).ToString(us),
          Math.Round(m_marginRight, 2).ToString(us),
          Math.Round(m_marginBottom, 2).ToString(us));
    
    m_reportStreams = new List<Stream>();
    try
    {
        // Tell SSRS to store one stream per page on server
        NameValueCollection urlAccessParameters = new NameValueCollection();
        urlAccessParameters.Add("rs:PersistStreams", "True");
    
        // Render first page
        Stream s = viewer.ServerReport.Render("IMAGE", deviceInfo, urlAccessParameters, out mime, out extension);
        m_reportStreams.Add(s);
    
        // Loop to get other streams
        urlAccessParameters.Remove("rs:PersistStreams");
        urlAccessParameters.Add("rs:GetNextStream", "True");
        do
        {
            s = viewer.ServerReport.Render("IMAGE", deviceInfo, urlAccessParameters, out mime, out extension);
            if (s.Length != 0) m_reportStreams.Add(s);
        }
        while (s.Length > 0);
    
        // Now there's one stream per page - do stuff with it
    }
    finally
    {
        foreach (Stream s in m_reportStreams)
        {
            s.Close();
            s.Dispose();
        }
        m_reportStreams = null;
    }
    

    EDIT
    Forgot to mention that viewer is a programmatically created instance of the ReportViewer control initialized to render the report that you’re trying to print/save.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
I'm working on exporting data from an existing accounting system written in C# in
I'm working on a project where we are dealing with importing/exporting data from database
I'm exporting some data from MySQL which can be selected through checkboxes on a
I am working on exporting data and right now some fields export the value,
I'm working on exporting a managed solution from a dev environment into another, clean
Working with an undisclosed API, I found a function that can set the number
Working on game where plates will be falling from top to bottom. Some plates
I had a question about boost python. I've been working on exporting some functionality
I'm working on some VBA to do exporting and importing (using SaveAsText and LoadFromText)

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.