Añadir anexos
IronPDF permite añadir y eliminar archivos adjuntos a sus documentos PDF.
using IronPdf; using System.IO; // Instanciar el Renderizador y crear PdfDocument a partir de HTML var renderer = new ChromePdfRenderer(); var myPdf = renderer.RenderHtmlFileAsPdf("my-content.html"); // Carga tu propio archivo adjunto byte[] attachment = File.ReadAllBytes("path/to/attachment"); // Aquí podemos añadir un archivo adjunto con un nombre y un byte[] PdfAttachment exampleAttachment = myPdf.Attachments.AddAttachment("exampleAttachment", attachment); // Y he aquí un ejemplo de eliminación de un archivo adjunto myPdf.Attachments.RemoveAttachment(exampleAttachment); myPdf.SaveAs("my-content.pdf");
Imports IronPdf Imports System.IO ' Instanciar el Renderizador y crear PdfDocument a partir de HTML Private renderer = New ChromePdfRenderer() Private myPdf = renderer.RenderHtmlFileAsPdf("my-content.html") ' Carga tu propio archivo adjunto Private attachment() As Byte = File.ReadAllBytes("path/to/attachment") ' Aquí podemos añadir un archivo adjunto con un nombre y un byte[] Private exampleAttachment As PdfAttachment = myPdf.Attachments.AddAttachment("exampleAttachment", attachment) ' Y he aquí un ejemplo de eliminación de un archivo adjunto myPdf.Attachments.RemoveAttachment(exampleAttachment) myPdf.SaveAs("my-content.pdf")
Install-Package IronPdf
IronPDF permite añadir y eliminar archivos adjuntos a sus documentos PDF.
9 productos API .NET para sus documentos de oficina