0
我有一個模板,我想編輯並通過電子郵件發送。我有以下代碼,但編輯過的pdf表示我的數據「已損壞,無法修復」。我不確定我是否將編輯後的pdf發送出去。任何幫助表示讚賞。如何編輯/發送電子郵件中的pdf模板?
using (MemoryStream ms = new MemoryStream())
{
PdfStamper formFiller = new PdfStamper(reader, ms);
AcroFields formFields = formFiller.AcroFields;
formFields.SetField("Name", formData.Name);
formFields.SetField("Location", formData.Address);
formFields.SetField("Date", DateTime.Today.ToShortDateString());
formFields.SetField("Email", formData.Email);
formFiller.FormFlattening = true;
formFiller.Close();
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("[email protected]"));
msg.From = new MailAddress("[email protected]");
msg.Subject = "Application Form";
msg.Body = "TEST";
msg.IsBodyHtml = true;
ms.Position = 0;
msg.Attachments.Add(new Attachment(ms, "Application.pdf", "application/x-pdf"));
SmtpClient client = new SmtpClient("10.1.1.15");
client.UseDefaultCredentials = true;
}
如果您取出電子郵件邏輯並編輯並保存PDF,它是否仍然損壞? – Jason 2011-06-02 19:34:01
我認爲這是我想要做的......但我不知道該怎麼做。 – MrM 2011-06-02 19:42:58