i'm using Aspose.Pdf.Net version 6.0.0 and Microsoft NET 3.5 SP1.
I need to extract a xml attatchment from a in memory pdf file containing other attatchments too.
I tried to use this code:
byte pdfDocument = pdfConsegna.PdfContent;
PdfExtractor extractor = new PdfExtractor();
using (MemoryStream pdfMs = new MemoryStream(pdfDocument))
// estract xml byte by filename
IList attachmentNames = extractor.GetAttachNames();
foreach (string attName in attachmentNames)
// check if fileName is a xml
if (Path.GetExtension(attName).ToLowerInvariant() == ".xml")
// extract attachment by fileName
MemoryStream xmlMSs = extractor.GetAttachment(); // this does'n work, xmlMSs is null
if (xmlMSs != null)
MemoryStream xmlMS = xmlMSs;
// assign values
xmlDocument.FileName = attName;
xmlDocument.FileContent = xmlMS.ToArray();
but the code does'nt work because GetAttachment() funtion returns null;
Can you help me?
How can i extract a specific attachment?
Thank you very much.