When I embed random files into pdf, sometimes I cannot open the first file when displaying the .pdf using Adobe Acrobat.
What's weird, when I change the names of attachments (since acrobat shows the attachment list alphabetically ordered), the same file that couldn't be opened has no problems at all. Files I use stay the same, just names change.
So, in this example when I name the files named thusly, I get no errors:
Code: Select all
Plain text only.eml
test.rtf
zchilipepper.jpg
Code: Select all
chilipepper.jpg
Plain text only.eml
test.rtf
My code for embeding files into pdf
Code: Select all
Output_PDF.LoadFromStream(new MemoryStream(Input_PDF_Data));
string[] Files = Directory.GetFiles(Temp_Attachements_Dir);
for (int i = 0; i < Files.Length; i++)
{
Output_PDF.EmbedFile(Files[i], Path.GetFileName(Files[i]), "");
File.Delete(Files[i]);
}
Stream stm = (Stream)new MemoryStream();
Output_PDF.SaveToStream(stm);
Output_PDF_Data = ((MemoryStream)stm).ToArray();
Thank you for your response,
Martin Halla,
Software602