单击按钮时使用Response.BinaryWrite

时间:2011-07-25 21:41:33

标签: pdf-generation

我有一个按钮点击事件,并在其中调用此方法生成pdf。这在我第一次点击按钮时工作正常,但是如果我再次单击按钮再次执行操作则不起作用。感谢。

 private void CreatePDF(Customer c)
    {
        Response.ClearHeaders();
        Response.ClearContent();
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-disposition", "attachment; filename=test.pdf;");
        Response.BinaryWrite(GetPrintableCustomer(c));
        Response.End();
    }

0 个答案:

没有答案
相关问题