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