博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

生成PDF文档

Posted on 2014-01-14 09:41  随遇  阅读(140)  评论(0编辑  收藏  举报

byte[] buffer = 

context.Response.Clear();
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.ContentType = "application/pdf";
context.Response.AppendHeader("Content-Disposition", String.Format("inline; filename=xxxx{0}.pdf", DateTime.Now.ToString("yyyyMMddhhmmss", System.Globalization.CultureInfo.InvariantCulture)));
if (buffer != null)
{
  context.Response.BinaryWrite(buffer);
}
context.Response.End();