【发布时间】:2013-08-23 04:03:46
【问题描述】:
我正在使用 iTextSharp 创建 PDF 文件(我使用 C#)。该文件创建良好;但是,它保存在一个文件夹中。该文件是响应链接按钮单击而创建的,我想显示“打开/保存”对话框,而不是将文件保存在文件夹中。 我使用以下内容:
using(MemoryStream ms = new MemoryStream())
{
Document doc1 = new Document();
PdfWriter pdfw = PdfWriter.GetInstance(doc1, ms);
doc1.open();
string sPath = Server.MapPath("PDF/");
string sFileName = "Something.PDF";
// create the PDF content
doc1.Close();
byte[] content = ms.ToArray();
using (FileStream fs = FileStream.Create(sPath + sFileName))
{
fs.Write(content, 0, (int)content.Length);
}
}
我做错了吗?它创建文件并将其保存在“blahblah/PDF”文件夹中,但不显示打开/保存对话框 bx。
【问题讨论】:
-
您没有标记此 ASP.Net,所以您是在使用桌面应用程序吗?
-
这是一个网络应用程序(.Net 3.5,C# 2.0)
标签: c# pdf itextsharp save-as