高效率新增HTML內容
IronPDF.PdfDocument.ApplyMultipleStamps可讓開發人員快速地在 PDF 的一個或多個頁面上新增多種類型的印章。 要了解有關此功能和 IronPDF 其他功能的更多信息,請訪問IronPDF 產品頁面以獲取詳細資訊。
準備好開始了嗎?
Nuget 下載 17,012,929 | 版本: 2025.12 剛剛發布
using IronPdf;
using IronPdf.Editing;
using System;
// Use HtmlStamper to stamp Html onto pdf
HtmlStamper htmlStamper = new HtmlStamper("<h1>Html stamp</h1>")
{
VerticalOffset = new Length(-200, MeasurementUnit.Pixel),
HorizontalOffset = new Length(-200, MeasurementUnit.Pixel),
};
// Use TextStamper to stamp text with custom font onto pdf
TextStamper textStamper = new TextStamper("Hello World! Stamp One Here!")
{
FontFamily = "Bungee Spice",
UseGoogleFont = true,
FontSize = 30,
};
// Use ImageStamper to stamp images onto pdf
Uri filepath = new Uri(@"C:\assets\logo.png"); // absolute path or URL
ImageStamper imageStamper = new ImageStamper(filepath)
{
VerticalAlignment = VerticalAlignment.Top,
MinWidth = new Length(20),
MinHeight = new Length(20),
};
// Use BarcodeStamper to stamp QR code/Barcode onto pdf
BarcodeStamper barcodeStamper = new BarcodeStamper("IronPDF", BarcodeEncoding.Code128)
{
Height=75,
VerticalAlignment = VerticalAlignment.Bottom,
HorizontalAlignment = HorizontalAlignment.Left,
};
Stamper[] stamps = { htmlStamper, textStamper, imageStamper, barcodeStamper };
var pdf = PdfDocument.FromFile("Unstamped.pdf");
pdf.ApplyMultipleStamps(stamps);
pdf.SaveAs("Stamped.pdf");Install-Package IronPdf
IronPDF.PdfDocument.ApplyMultipleStamps可讓開發人員快速地在 PDF 的一個或多個頁面上新增多種類型的印章。 要了解有關此功能和 IronPDF 其他功能的更多信息,請訪問IronPDF 產品頁面以獲取詳細資訊。