Stamping New Content

// Install IronPdf with Nuget: PM> Install-Package IronPdf
using IronPdf;
//PDFs can be edited or amended by stamping new HTML content into the foreground or background.
IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
var pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf");
var BackgroundStamp = new HtmlStamp() { Html = "<img src='logo.jpg' />", Width = 50, Height = 25, Opacity = 50, Bottom = 5, ZIndex = HtmlStamp.StampLayer.BehindExistingPDFContent, HtmlBaseUrl = new Server.MapPath("~/assets/") };
pdf.StampHTML(BackgroundStamp);
var ForegroundStamp = new HtmlStamp() { Html = "<h2 style='color:red'>copyright 2018 ironpdf.com", Width = 50, Height = 50, Opacity = 50, Rotation = -45, ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent };
pdf.StampHTML(ForegroundStamp);
pdf.SaveAs(@"C:\Path\To\Stamped.pdf");
' Install IronPdf with Nuget: PM> Install-Package IronPdf
Imports IronPdf
'PDFs can be edited or amended by stamping new HTML content into the foreground or background.
Private Renderer As New IronPdf.HtmlToPdf()
Private pdf = Renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
Private BackgroundStamp = New HtmlStamp() With {
.Html = "<img src='logo.jpg' />",
.Width = 50,
.Height = 25,
.Opacity = 50,
.Bottom = 5,
.ZIndex = HtmlStamp.StampLayer.BehindExistingPDFContent,
.HtmlBaseUrl = New Server.MapPath("~/assets/")
}
pdf.StampHTML(BackgroundStamp)
Dim ForegroundStamp = New HtmlStamp() With {
.Html = "<h2 style='color:red'>copyright 2018 ironpdf.com",
.Width = 50,
.Height = 50,
.Opacity = 50,
.Rotation = -45,
.ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent
}
pdf.StampHTML(ForegroundStamp)
pdf.SaveAs("C:\Path\To\Stamped.pdf")
Developers may edit any PDF document by adding new content to any page (or pages) using the StampHTML method.