Add Attachments to PDF via C#
Add Attachments to PDF document. Use Aspose.PDF for .NET to modify PDF files programmatically
How to Add Attachments Using .NET Library
In order to add Attachments in PDF file, we’ll use Aspose.PDF for .NET API which is a feature-rich, powerful and easy to use document manipulation API for net platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.
Add Attachments in PDF File via C#
You need Aspose.PDF for .NET to try the code in your environment.
- Create a new C# project.
- Add a reference to Aspose.PDF DLL.
- Create a Document object.
- Create a FileSpecification object with the file you are adding, and file description.
- Add the FileSpecification object to the Document object’s EmbeddedFiles collection, with the collection’s Add method
- Save the PDF file.