With Foxit PDF SDK, attachments refer to documents rather than file attachment annotations. This allows whole files to be embedded in a document, much like email attachments. PDF SDK provides application APIs to access functions such as loading attachments, getting attachments, inserting/removing attachments, and accessing properties of attachments.
Example:
How to insert an attachment file into a PDF
using foxit; using foxit.common; using foxit.common.fxcrt; using foxit.pdf; using foxit.pdf.objects; // Assuming PDFDoc doc has been loaded. string text_path = "The input path of the attached file you need to insert"; Attachments attachments = new Attachments(doc, new PDFNameTree()); attachment.AddFromFilePath("OriginalAttachmentsInfo", text_path); ...
How to remove a specific attachment of a PDF
using foxit; using foxit.common; using foxit.common.fxcrt; using foxit.pdf; using foxit.pdf.objects; // Assuming PDFDoc doc has been loaded. ... Attachments attachment = new Attachments(doc, new PDFNameTree()); string strKey = attachment.GetKey(index); attachment.RemoveEmbeddedFile(strKey);