Hi,
I am not able to extract attachments from PDF. // 4 files are attached.
I am getting Null values.
public void ExtractAttachments(string Folder)
{
try
{
foreach (FileSpecification fileSpecification in PdfDocument.EmbeddedFiles)
{
byte[] fileContent = new byte[fileSpecification.Contents.Length];
fileSpecification.Contents.Read(fileContent, 0, fileContent.Length);
string file = Path.GetFileName(fileSpecification.Name); // getting null
string fileName = Path.Combine(Folder, file);
FileStream fileStream = new FileStream(fileName, FileMode.Create);
fileStream.Write(fileContent, 0, fileContent.Length);
fileStream.Close();
}
}
catch (Exception ex)
{
throw error ; \Value cannot be null
}
}
Any help would be appreciated !!