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")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 下載次數 22,198,312|版本:2026.11剛剛發布
當您需要您的PDF看起來像HTML一樣快速。