我正在使用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);
}
}
我做错了吗?它创建文件并将其保存在“blahbah/PDF”文件夹中,但不显示“打开/保存”对话框bx。