0
我製作pdf文件在iTextSharp庫。我使用下面的代碼。這pdf是自動保存在文件夾中。但我想要pdf打開是在新選項卡中。怎麼可能。打開pdf是在新標籤
using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{
using (iTextSharp.text.Document doc = new iTextSharp.text.Document())
{
using (iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, ms))
{
doc.Open();
doc.Add(new iTextSharp.text.Paragraph(lblMessage.Text.ToString()));
doc.Close();
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Receipt3.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(ms.ToArray());
System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
}
}
}