新增附件
IronPDF 支援在 PDF 文件中新增和刪除附件。
如需了解更多信息,您可以查閱IronPDF 文檔,其中提供了詳細的指南和資源。 此外,您還可以在Iron Software 網站上了解更多功能和功能。
準備好開始了嗎?
Nuget 下載 17,012,929 | 版本: 2025.12 剛剛發布
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");Install-Package IronPdf
IronPDF 支援在 PDF 文件中新增和刪除附件。
如需了解更多信息,您可以查閱IronPDF 文檔,其中提供了詳細的指南和資源。 此外,您還可以在Iron Software 網站上了解更多功能和功能。