0

I created an application that will run sql scripts based on user selection in C# and I am using pdfcrowd to print the page to PDF. When a user user gets to the page they see the chart as the "new state". After they make a selection the cells in columns Dataset 1 and Dataset 2 are filled with averages. When I hit my print button, instead of the pdf showing the page in its "current state"; it instead prints it out as though the user has made no selections, however the .net page retains the information that the user selected. How do I print out the page in its current state? Here is my code for the print function:

System.Web.HttpResponse Response = System.Web.HttpContext.Current.Response;
try
{
    // create an API client instance
    pdfcrowd.Client client = new pdfcrowd.Client("userid", "appID");

    // convert a web page and write the generated PDF to a memory stream
    MemoryStream Stream = new MemoryStream();
    client.convertURI("http://www.somelinksomewhere.com", Stream);
    client.setPageWidth("8.5in");

    // set HTTP response headers
    Response.Clear();
    Response.AddHeader("Content-Type", "application/pdf");
    Response.AddHeader("Cache-Control", "max-age=0");
    Response.AddHeader("Accept-Ranges", "none");
    Response.AddHeader("Content-Disposition", "attachment; filename=my_nonworking.pdf");

    // send the generated PDF
    Stream.WriteTo(Response.OutputStream);
    Stream.Close();
    Response.Flush();
    Response.End();
 }
 catch (pdfcrowd.Error idunno)
 {
    Response.Write(idunno.ToString());
 }
Skullomania
  • 2,225
  • 2
  • 29
  • 65

0 Answers0