Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Os anexos podem conter uma ampla variedade de informações e podem ser de vários tipos de arquivos. Este artigo explica como adicionar um anexo a um arquivo PDF.
O próximo trecho de código também funciona com a biblioteca Aspose.Drawing.
A coleção EmbeddedFiles contém todos os anexos no arquivo PDF. O seguinte trecho de código mostra como adicionar um anexo em um 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.