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.


Here is my code for print

System.Web.HttpResponse Response = System.Web.HttpContext.Current.Response;
                // 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("", Stream);

                // set HTTP response headers
                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
            catch (pdfcrowd.Error idunno)
support wrote on 2014-07-03:

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.