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