I'm using the following code to generate a PDF with text & embed files:
Code: Select all
private void WriteEmail(sEmail email, string filename) {
GdPicture14.GdPicturePDF oPDF = new GdPicture14.GdPicturePDF();
oPDF.CreateFromText(GdPicture14.PdfConformance.PDF1_4, 595, 842, 30, 30, 30, 30, GdPicture14.TextAlignment.TextAlignmentNear, email.emailContent, 12, "Calibri", false, false, false, false);
string orgFilename;
string newFilename;
for (int i = 0; i < email.Attachments.Count; i++)
{
if (oPDF.EmbedFile(email.Attachments[i].newFilename, "") != GdPicture14.GdPictureStatus.OK)
{
Console.WriteLine("ERROR INSERTING ATTACHMENT");
}
}
oPDF.SaveToFile(filename);
}
I have seen this happen to jpegs, gif files, html documents, etc.
What could be causing this? I can't share the files that are causing the issue because of data protection. I can confirm that if I add the same attachments using acrobat pro, it is able to view and delete them.
Am I creating the pdf incorrectly? Either that, or maybe there is a bug in the pdpicture attachment code? This is happening to about 1 in 50 PDF's I'm creating.
I have tried a few versions of GDPicture 14, including the latest as of today.
Cheers,
Matt