Document.EmbeddedFiles modification

Hi,


I am working on PDF portfolio documents, where I want to modify every pdf file in the portfolio. These files can be found under Document.EmbeddedFiles collection(as FileSpecification classes).

FileSpecification.Content is the stream for the document content, and it has both getter and setter. However, whatever I do with this FileSpecification object (such as fileSpecification.Content = processedStream), and save the document(Pdf.Document) somewhere; I cannot see any changes on the file itself. As a workaround, I delete and add FileSpecifications to EmbeddedFiles collection with the following code, and it works.

for (int i = document.EmbeddedFiles.Count; i > 0; i–)
{
FileSpecification embeddedFile = document.EmbeddedFiles[i];
var processedStream= Process(embeddedFile);
var filename = document.EmbeddedFiles[i].Name;
var description = document.EmbeddedFiles[i].Description;
document.EmbeddedFiles.Delete(i - 1);
document.EmbeddedFiles.Add(new FileSpecification(processedStream, filename, description));
}

This works alright, but doesn’t look right one bit. If there is a way to modify the pdf files under portfolio that’s what I’d like to learn. Otherwise, I think “fileSpecification.Content = processedStream” should change the content when the document is saved.

Regards,
Natan Abolafya

Hi Natan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please share your complete sample code and portfolio file with us. We will check your issue and get back to you soon.

Sorry for the inconvenience,