IronPDF支持向PDF文档添加和移除附件。
欲了解更多信息,您可以浏览IronPDF文档,其中提供了详细的指南和资源。 此外,还可以在Iron Software 网站了解更多功能和能力。
使用 IronPDF 学习在 PDF 中添加/删除附件。using IronPdf;
using System.IO;
// Instantiate the Renderer and create PdfDocument from HTML
var renderer = new ChromePdfRenderer();
var myPdf = renderer.RenderHtmlFileAsPdf("my-content.html");
// Load your own attachment
byte[] attachment = File.ReadAllBytes("path/to/attachment");
// Here we can add an attachment with a name and a byte[]
PdfAttachment exampleAttachment = myPdf.Attachments.AddAttachment("exampleAttachment", attachment);
// And here is an example of removing an attachment
myPdf.Attachments.RemoveAttachment(exampleAttachment);
myPdf.SaveAs("my-content.pdf");
Imports IronPdf
Imports System.IO
' Instantiate the Renderer and create PdfDocument from HTML
Dim renderer As New ChromePdfRenderer()
Dim myPdf = renderer.RenderHtmlFileAsPdf("my-content.html")
' Load your own attachment
Dim attachment As Byte() = File.ReadAllBytes("path/to/attachment")
' Here we can add an attachment with a name and a byte()
Dim exampleAttachment As PdfAttachment = myPdf.Attachments.AddAttachment("exampleAttachment", attachment)
' And here is an example of removing an attachment
myPdf.Attachments.RemoveAttachment(exampleAttachment)
myPdf.SaveAs("my-content.pdf")IronPDF支持向PDF文档添加和移除附件。
欲了解更多信息,您可以浏览IronPDF文档,其中提供了详细的指南和资源。 此外,还可以在Iron Software 网站了解更多功能和能力。
使用 IronPDF 学习在 PDF 中添加/删除附件。Nuget Downloads 20,990,528|版本:2026.9刚刚发布