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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:09:52+00:00 2026-05-20T03:09:52+00:00

Scenario: I have a web page with multiple charts and I have an ‘Export

  • 0

Scenario:

I have a web page with multiple charts and I have an ‘Export to PDF’ button that the User should be able to click and it generates a PDF that the User can then save.

Given:

A Telerik RadChart that can save itself into a memory stream as such:

MemoryStream chartStream = new MemoryStream();
RadChart1.Save(chartStream, ImageFormat.Png);

Using this memory stream, is it possible to build a PDF using the SQL Reporting Services WITH OUT saving it to a file first OR having to insert it into an MSSQL table first?

I will up-vote and/or accept any answer that is an open source or free solution to this problem as well.

Thanks.

  • 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-20T03:09:52+00:00Added an answer on May 20, 2026 at 3:09 am

    Alright, just figured this out. There are three elements to this answer, two screenshots to follow in order and then some code:

    1. Creating a typed dataset to hold the chart image(s)

      Step 1

    2. Hooking the typed dataset up to the RDLC report

      Step 2

    3. The button click code for generating the PDF and streaming it to the browser.

      protected void btnPDF_Click(object sender, EventArgs e)
      {
          //Put the image you want to display in a MemoryStream.  You can read an image from the file system
          //or generate an image, etc.  This example renders an image to a memory stream using a custom charting control.
          MemoryStream chtLoginsByMonthStream = new MemoryStream();
          this.chtLoginsByMonth.Save(chtLoginsByMonthStream, ImageFormat.Png);
      
      
          //Setup the datatable you will pass into the RDLC
          dsStudentUsage.dtUsageChartsDataTable dt = new dsStudentUsage.dtUsageChartsDataTable();
          dsStudentUsage.dtUsageChartsRow dr = dt.NewdtUsageChartsRow();
      
          //create new Byte Array, this will hold the image data from the memory stream
          byte[] chtLoginsByMonthArray = new byte[chtLoginsByMonthStream.Length];
      
          //Set pointer to the beginning of the stream
          chtLoginsByMonthStream.Position = 0;
      
          //Read the entire stream
          chtLoginsByMonthStream.Read(chtLoginsByMonthArray, 0, (int)chtLoginsByMonthStream.Length);
      
          //Put the byte array into the new datarow in the appropriate column
          dr["imgLoginsByMonth"] = chtLoginsByMonthArray;
          dt.Rows.Add(dr);
      
          //Add the data source to the report.
          ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("dsStudentUsage_dtUsageCharts", dt));
      
          //Setup objects for streaming the PDF to the browser
          Warning[] warnings;
          string[] streamids;
          string mimeType;
          string encoding;
          string extension;
          byte[] bytes;
      
      
          //Make a container for all of your report parameters
          var rptList = new List<KeyValuePair<string, string>>();
          rptList.Add(new KeyValuePair<string, string>("rpTotalLogins", "2,000"));
          //more parameters go here
      
          //Feed the report parameters into the actual "ReportParameters" class
          ReportParameter[] rptParams = new ReportParameter[rptList.Count];
          for (int i = 0; i < rptList.Count; i++)
          {
              rptParams[i] = new ReportParameter(rptList[i].Key, rptList[i].Value);
          }
      
          //Set parameters for the report.
          ReportViewer1.LocalReport.SetParameters(rptParams);
      
          //Render the report to a byte array in PDF format
          bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
      
          //Set the stream to either prompt user as file download or "inline" to stream
          //PDF directly into the browser window.
      
          HttpContext.Current.Response.AddHeader("Content-disposition", "attachment; filename=StudentUsageReport.pdf");
          //HttpContext.Current.Response.AddHeader("Content-disposition", "inline;");
          HttpContext.Current.Response.ContentType = "application/pdf";
          HttpContext.Current.Response.BinaryWrite(bytes);
          HttpContext.Current.Response.End();
      
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario: I have a textbox and a button on a web page.
Scenario : I have a c# .net web page. I want the user to
Here is the scenario: I have 1 master page and web-forms in that master
Scenario: I have a Javascript-generated web page that someone else wrote a long time
Scenario: You have an ASP.Net webpage that should display the next image in a
The scenario: we have a web system that automatically generates office 2003 excel files
The Scenario I have an ASP.NET web project. I want to be able to
Pretty simple scenario. I have a web service that receives a byte array that
Let me share the following scenario: I have a ASP.NET intranet Web-based application that
Here is my scenario: i have a parent web page, in my javascript code

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.