0
我有這段代碼創建一個PDF文件,然後通過電子郵件發送。但是,當我運行它時,它會打開並將我的整個頁面更改爲PDF。如何停止頁面以打開PDF?如何通過電子郵件發送PDF而不打開它
PdfWriter.GetInstance(document, Response.OutputStream);
Response.ContentType = "application/pdf";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
HTMLWorker htmlparser = new HTMLWorker(document);
MemoryStream memoryStream = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
document.Open();
document.Add(mainTable);
Response.Write(document);
writer.CloseStream = false;
document.Close();
memoryStream.Position = 0;
EmailPresenter.SkyMail asd = new EmailPresenter.SkyMail();
asd.SendMail("[email protected]", "This is a test email...", memoryStream, "Test.pdf");
Response.End();
嗨,pdfwriter庫在iTextSharp.text.pdf =) – anonymous1110
嗨!謝謝!我刪除了前4行加上Response.Write(document);和Response.End();它的工作! – anonymous1110