Removes all non-annotation type of file attachments from a PDF file.
void RemoveAttachedFiles() throws PDFProcessorException
BclPrcResult RemoveAttachedFiles(BclPDFProcessorHandle* pHandle);
This function can be used in conjunction with AttachFile to edit portfolio PDF files. Portfolios are multimedia-rich documents that encapsulate other documents. Given a sample portfolio PDF, RemoveAttachedFiles can be used to create an empty portfolio of the same style. Next, AttachFile is called repeatedly to populate the blank portfolio with new content.
Make sure to set OptimizeAfterEachProcess to True in order to have all the original content permanently removed from the PDF. The function works without that, but your final output would carry the load from the original content, which not only increases the PDF file size unnecessarily, but could also cause copyright issues.
Set oProcessor = CreateObject("easyPDF.PDFProcessor.8") ' Make sure to permanently destroy unused content oProcessor.OptimizeAfterEachProcess = True Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf") ' Remove all existing attachments oProcessorHandle.RemoveAttachedFiles ' Replace them with a list of new attachments oProcessorHandle.AttachFile "C:\test\attachment0001.pdf", "1st attachment" oProcessorHandle.AttachFile "C:\test\attachment0002.pdf", "2nd attachment" oProcessorHandle.AttachFile "C:\test\attachment0003.pdf", "3rd attachment" oProcessorHandle.Close