We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Pdf attachment extraction


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[0];

// 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.


Thanks for using our products.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as <span style=“font-family:“Arial”,“sans-serif””>PDFNEWNET-29618. We will
investigate this issue in details and will keep you updated on the status of a
correction.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

apologize for your inconvenience.