This is an archived forum post. The information may be outdated. Contact us if you have any questions.

How do I print a page in the "current state"?

Omacnificent wrote on 2014-07-01:
I created an application that will run sql scripts based on user selection in C#. When a user user gets to the page they see the chart as the "new state"(please see attached photo). 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 print out showing the page in its "current state" (see second attached photo) 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.

Edited

Here is my code for print

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());
            }
support wrote on 2014-07-03:
Hello,

The state of the page must be encoded in the URL via a query string, otherwise the API will print the "initial state". The API doesn't know about the changes made by a user in the browser, it knows only the page URL.