Dear Aspose Team,
Hi Murali,
- Attachments come through PDF document catalog
- Attachments come through page, file attachment annotations.
Document pdf = new
Document(myDir + “attachfile.pdf”);<o:p></o:p>
int count = 0;<o:p></o:p>
foreach (Aspose.Pdf.Page
page in pdf.Pages)<o:p></o:p>
{<o:p></o:p>
foreach (Aspose.Pdf.InteractiveFeatures.Annotations.Annotation annot in
page.Annotations)<o:p></o:p>
{<o:p></o:p>
if (annot is FileAttachmentAnnotation)<o:p></o:p>
{<o:p></o:p>
Console.WriteLine((annot as
FileAttachmentAnnotation).File.Params.CreationDate);<o:p></o:p>
Console.WriteLine((annot as
FileAttachmentAnnotation).File.Params.ModDate);<o:p></o:p>
Console.WriteLine((annot as
FileAttachmentAnnotation).File.Params.Size);<o:p></o:p>
Console.WriteLine((annot as
FileAttachmentAnnotation).File.Name);<o:p></o:p>
count++;<o:p></o:p>
FileAttachmentAnnotation
attachment = (annot as FileAttachmentAnnotation);<o:p></o:p>
using (BinaryReader
reader = new BinaryReader(attachment.File.Contents))<o:p></o:p>
using (BinaryWriter
writer = new BinaryWriter(new FileStream(myDir
-
Path.GetFileName(attachment.File.Name), FileMode.Create)))<o:p></o:p>
writer.Write(reader.ReadBytes((int)attachment.File.Contents.Length));<o:p></o:p>}<o:p></o:p>
}<o:p></o:p>
}<o:p></o:p>
Please feel free to contact us for any further assistance.
Best Regards,
Hi Tilal,
Hi Murali,