C# 如何在当前状态下打印页面?
我创建了一个应用程序,它将根据C#中的用户选择运行sql脚本,并使用pdfcrowd将页面打印为PDF。当用户进入页面时,他们会将图表视为“新状态”。选择后,C# 如何在当前状态下打印页面?,c#,webforms,html-to-pdf,C#,Webforms,Html To Pdf,我创建了一个应用程序,它将根据C#中的用户选择运行sql脚本,并使用pdfcrowd将页面打印为PDF。当用户进入页面时,他们会将图表视为“新状态”。选择后,Dataset 1和Dataset 2列中的单元格填充平均值。当我点击我的打印按钮,而不是pdf显示页面的“当前状态”;相反,它会将其打印出来,就像用户没有进行任何选择一样,但是.net页面保留了用户选择的信息。如何打印当前状态下的页面?以下是我的打印功能代码: System.Web.HttpResponse Response = Syst
Dataset 1
和Dataset 2
列中的单元格填充平均值。当我点击我的打印按钮,而不是pdf显示页面的“当前状态”;相反,它会将其打印出来,就像用户没有进行任何选择一样,但是.net页面保留了用户选择的信息。如何打印当前状态下的页面?以下是我的打印功能代码:
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());
}
我想问题出在观众而不是pdfcrowd。。。您正在使用什么查看器?尝试查看、打印。。。正在清除查看器缓存。。。然后更改它并打印它。。。发生了什么?可能这些选择是在客户端进行的,它们也需要在服务器端进行。。。。