Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Los archivos adjuntos pueden contener una amplia variedad de información y pueden ser de varios tipos de archivos. Este artículo explica cómo agregar un archivo adjunto a un archivo PDF.
El siguiente fragmento de código también funciona con la biblioteca Aspose.Drawing.
La colección EmbeddedFiles contiene todos los archivos adjuntos en el archivo PDF. El siguiente fragmento de código te muestra cómo agregar un archivo adjunto en un documento PDF.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddEmbeddedFile()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Attachments();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "AddAttachment.pdf"))
{
// Setup new file to be added as attachment
Aspose.Pdf.FileSpecification fileSpecification = new Aspose.Pdf.FileSpecification(dataDir + "test.txt", "Sample text file");
// Add attachment to document's attachment collection
document.EmbeddedFiles.Add(fileSpecification);
// Save PDF document
document.Save(dataDir + "AddAnnotations_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.