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

Free Support Forum - aspose.com

Is it possible to update embedded files with new versions?

Is it possible to update an embedded file in a PDF Portfolio using Aspose.PDF? My attempts so far have failed. The problems I'm having seem to be related to two things - creating a new FileSpecification object and replacing the currently existing item from the Document.EmbeddedFiles collction.

For the FileSpecification object, I've tried extracting the exisiting document to both a memory stream and to a file stream, and then create a new FileSpecification object from the results of that. The resulting object never seems to have its MIMEType or Params properties set. I'm not sure the Params property needs to be set, but the MIMEType is important, and there doesn't appear to be a way to set it after the fact. Is there a way to create a FileSpecification that has the MIMEType set and, if possible, the Params object?

As far as replacing the currently existing item in the Document.EmbeddedFiles collection, there are multiple issues. First, when I delete the original item by index, it sometimes deletes the wrong object. This may be because the collection has been reindexed from the last update (multiple embedded documents get updated in the same routine). Is there a way to delete the original item by object reference or by name, perhaps, or a way to determine the current index of a FileSpecification in the EmbeddedFile collection?

Next, I'm not convinced the EmbeddedFileCollection.Delete method is even working - the Count property does not change after calling it, and sometimes my results have had the original and the updated document in the resulting portfolio. Do I need to save the portfolio after deleting the embedded item to update the count, perhaps?

It also appears that sometimes the files that do get added back to the portfolio aren't added correctly, as when I view the resulting file it isn't able to display the embedded document. This could be because of the MIMEType issue above, but Adobe Reader does appear to identify it as a PDF file, as it displays the correct icon in place of the document it's trying to display, but it apparently can't read the document.

So, my question is whether this is even possible using Aspose.PDF. It seems like all the properties and methods needed to do this exist (though it would be easier if the collection object behaved more like a .NET collection), but it doesn't appear to work.

Thanks for any help on this.

-- Michael Whalen

Hi Michael,


Thank you for the information. I’ve logged an investigation as PDFNEWNET-35055 in our issue tracking system. As soon as we have made some significant progress, we would be more than happy to update you with the status of correction.

We are sorry for this inconvenience.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35055) have been fixed in Aspose.Pdf for .NET 8.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.