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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:59:38+00:00 2026-05-24T12:59:38+00:00

I am trying to generate a pdf using the Reporting services 2005 webservice. I

  • 0

I am trying to generate a pdf using the Reporting services 2005 webservice. I have the pdf generation part working, but I am not sure how to get a “physical” pdf that I can attach to an email before sending it on its way.

I have created the pdf following this guide: http://www.codeproject.com/KB/reporting-services/PDFUsingSQLRepServices.aspx

public void RenderPdf(string rptMemo, string emailAddress )
{
    // Prepare Render arguments
    string historyID = null;
    string deviceInfo = null;
    string format = "PDF";
    Byte[] results;
    string encoding = String.Empty;
    string mimeType = String.Empty;
    string extension = String.Empty;
    Rse2005.Warning[] warnings = null;
    string[] streamIDs = null;

    //Credentials that will be passed to reporting services
    Rse2005.ReportExecutionService rsExec = new Rse2005.ReportExecutionService();
    rsExec.Credentials = new NetworkCredential("username", "password", "domain");

    //Report is called "Report1", it takes a parameter called "Id"
    Rse2005.ExecutionInfo ei = rsExec.LoadReport("/Reports/Report1", historyID);
    Rse2005.ParameterValue[] rptParameters = new Rse2005.ParameterValue[1];

    rptParameters[0] = new Rse2005.ParameterValue();
    rptParameters[0].Name = "Id";
    rptParameters[0].Value = RptMemo;

    //render the PDF
    rsExec.SetExecutionParameters(rptParameters, "en-us");
    results = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);


    HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=DetailedQuote.pdf");
    HttpContext.Current.Response.OutputStream.Write(results, 0, results.Length);

    //This is very important if you want to directly download from stream instead of file.
    HttpContext.Current.Response.End();
}

From this point I am able to call the RenderPdf method and I am prompted to open/save/cancel the file. I understand how to send an email with an attachment from the harddrive but I am not sure how to make results[] into a format I can handle.

thanks in advance

  • 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-24T12:59:40+00:00Added an answer on May 24, 2026 at 12:59 pm

    You should save the pdf to disk or memory and then use System.Net.Mail to send it
    Here is a quick link from google.
    http://www.systemnetmail.com/faq/3.4.2.aspx

    You can write results from your example to a memory stream like so

        var memStream = new MemoryStream(); 
        memStream.Write(results, 0 , results.Length);
    

    You should remove these 3 lines from your code

        HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=DetailedQuote.pdf");
        HttpContext.Current.Response.OutputStream.Write(results, 0, results.Length);
        HttpContext.Current.Response.End();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to generate a PDF document using FOP. The pdf generation code is
I'm trying to have table borders in my PDF using pisa to generate the
I am trying to generate a PDF using XSL(XML-FO) to transform a generated XML
I'm trying to generate a PDF document using FOP and Java. I receive the
I'm trying to generate a pdf from template using this snippet: def write_pdf(template_src, context_dict):
I am using Websupergoo's ABCpdf for ASP.NET and I am trying to generate PDF's
G'day guys, trying to build a small invoicing system (that can generate PDF's using
I am trying to generate equivalent MD5 hashes in both JavaScript and .Net. Not
I'm trying to generate code coverage reports with EMMA using tests of which some
I have a report in MS reporting services that renders just fine to the

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.