Stamping New Content
import {PdfDocument, HorizontalAlignment, VerticalAlignment} from "@ironsoftware/ironpdf";

(async () => {
    // Open existing PDF
    const pdf = await PdfDocument.fromFile("Sample.pdf");

    // Configure the HTML stamp
    const stampOptions = {
        horizontalAlignment: HorizontalAlignment.Center,
        verticalAlignment: VerticalAlignment.Bottom,
        behindExistingContent: false,
        opacity: 30
    };

    const html = "<img src='https://ironpdf.com/img/products/ironpdf-logo-text-dotnet.svg'/>"
    // Apply the stamp to the PDF
    await pdf.stampHtml(html, {htmlStampOptions: stampOptions});

    // Save the stamped PDF
    await pdf.saveAs("stamped_image.pdf");
})();
npm i @ironsoftware/ironpdf
Stamping New Content

Stamping New Content

HTML stamping leverages an input HTML fragment, granting control over design through inline CSS styling. In the code below, we include images within the HTML and then stamp them onto the document.

IronPDF offers a variety of versatile stamping options, including HTML, text, images, and barcodes. For each stamp, you can precisely define its position using both vertical and horizontal general locations. These locations can be further adjusted using offsets to achieve pixel-perfect placement. Additionally, most stamp types include opacity and rotation properties.

Explore HTML Stamping Example on GitHub
View on GitHub

Ready to Get Started?

Version:2026.11just released