How to Stamp QR Codes into PDF Pages

Embed QR codes directly into your PDF documents to instantly watermark pages or add dynamic information like URLs, tracking IDs, or digital signatures.

Adding a QR code to an existing PDF is a common requirement in document workflows. Invoice PDFs can carry a QR code linking to a payment portal. Government records can embed a verification code. Event tickets can include a scannable ID without restructuring the entire document layout. IronQR makes this straightforward: generate a QR code with QrWriter.Write and stamp it to any page at any position with a single call to DrawBitmap.

This guide demonstrates how to embed QR codes into existing PDF files using the IronQR library. Developers who have not yet generated a QR code should start with the Create QR Code as Image guide first.

Quickstart: Stamp a QR Code into a PDF

Generate a QR code and stamp it onto an existing PDF page at a specific position.

  1. Install IronQR with NuGet Package Manager

    PM > Install-Package IronQR
  2. Copy and run this code snippet.

    var qrBitmap = QrWriter.Write("https://example.com").Save();
    var pdf = PdfDocument.FromFile("document.pdf");
    pdf.Pages[0].DrawBitmap(qrBitmap, 505, 20, 70, 70);
    pdf.SaveAs("stamped.pdf");
  3. Deploy to test on your live environment

    Start using IronQR in your project today with a free trial

    arrow pointer

Stamping a QR Code onto a PDF Page

To embed a QR code into an existing PDF, generate the QR code with QrWriter.Write and save it to an AnyBitmap with Save(). Load the target PDF with PdfDocument.FromFile, then use DrawBitmap to place the QR code at precise coordinates. The x and y values are in PDF points (an A4 page is 595 × 842 pts), and desiredWidth and desiredHeight control the stamped size.

Input

The QR code below encodes https://ironsoftware.com and will be stamped onto the PDF.

QR code bitmap encoding https://ironsoftware.com
:path=/static-assets/qr/content-code-examples/how-to/stamp-qr-code-to-pdf.cs
using IronQr;
using IronPdf;
using IronSoftware.Drawing;

// Generate QR code bitmap
AnyBitmap qrBitmap = QrWriter.Write("hello world").Save();

// Load the existing PDF
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");

// Stamp the QR code at the top-right corner of page 1
// A4 page is 595 x 842 PDF points; x:505, y:20 places a 70pt QR near the top-right
pdf.DrawBitmap(qrBitmap, 0, 505, 20, 70, 70);

pdf.SaveAs("sample.pdf");
Imports IronQr
Imports IronPdf
Imports IronSoftware.Drawing

' Generate QR code bitmap
Dim qrBitmap As AnyBitmap = QrWriter.Write("hello world").Save()

' Load the existing PDF
Dim pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")

' Stamp the QR code at the top-right corner of page 1
' A4 page is 595 x 842 PDF points; x:505, y:20 places a 70pt QR near the top-right
pdf.DrawBitmap(qrBitmap, 0, 505, 20, 70, 70)

pdf.SaveAs("sample.pdf")
$vbLabelText   $csharpLabel

The modified PDF is saved with SaveAs. To avoid overwriting the source, pass a different output path.

Output

The QR code is stamped at the top-right corner of page 1 at coordinates (505, 20) with a size of 70 × 70 PDF points.


Controlling Position and Page Number

The x and y parameters are in PDF points measured from the top-left corner of the page. Increasing x moves the stamp to the right; increasing y moves it down. The pageIndex parameter is zero-based, so pageIndex: 0 targets the first page.

The following example stamps two QR codes on different pages — a verification link at the top-right of page 1 and a support link at the bottom-left of page 2:

Input

The two QR codes below encode the verification and support URLs that will be stamped onto separate pages.

QR code encoding https://ironsoftware.com/verify
QR code encoding https://ironsoftware.com/support
:path=/static-assets/qr/content-code-examples/how-to/stamp-qr-code-to-pdf-positions.cs
using IronQr;
using IronPdf;
using IronSoftware.Drawing;

PdfDocument pdf = PdfDocument.FromFile("document.pdf");

// Page 1: stamp a verification QR at the top-right corner
AnyBitmap qrVerify = QrWriter.Write("https://ironsoftware.com/verify").Save();
pdf.DrawBitmap(qrVerify, 0, 505, 20, 70, 70);

// Page 2: stamp a support QR at the bottom-left corner
AnyBitmap qrSupport = QrWriter.Write("https://ironsoftware.com/support").Save();
pdf.DrawBitmap(qrSupport, 1, 20, 752, 70, 70);

pdf.SaveAs("document.pdf");
Imports IronQr
Imports IronPdf
Imports IronSoftware.Drawing

Dim pdf As PdfDocument = PdfDocument.FromFile("document.pdf")

' Page 1: stamp a verification QR at the top-right corner
Dim qrVerify As AnyBitmap = QrWriter.Write("https://ironsoftware.com/verify").Save()
pdf.DrawBitmap(qrVerify, 0, 505, 20, 70, 70)

' Page 2: stamp a support QR at the bottom-left corner
Dim qrSupport As AnyBitmap = QrWriter.Write("https://ironsoftware.com/support").Save()
pdf.DrawBitmap(qrSupport, 1, 20, 752, 70, 70)

pdf.SaveAs("document.pdf")
$vbLabelText   $csharpLabel

Please notePDF points are the unit of measurement for coordinates on a PDF page. An A4 page is 595 pts wide and 842 pts tall, with (0, 0) at the top-left corner. To place a 70 pt QR code with a 20 pt margin from the top-right edge, subtract the QR size and margin from the page width: x = 595 − 70 − 20 = 505, and keep y = 20 to sit near the top. For the bottom-left corner, x = 20 and subtract from the page height: y = 842 − 70 − 20 = 752.

Output

Each QR code is placed at its respective corner — verification at the top-right of page 1, support at the bottom-left of page 2.


Use Cases

  • Invoice payment link: Encode a payment portal URL and stamp it at the top-right corner of page 1 so customers can scan and pay instantly.
  • Document verification: Encode a record ID or hash and stamp it at the bottom of every page to allow recipients to verify authenticity.
  • Event tickets: Encode an attendee ID or booking reference and stamp it at the centre of page 1 for easy scanning at entry.
  • Product labels: Encode a product URL or serial number and stamp it at the top-left or bottom-right corner for quick inventory lookups.
  • Legal records: Encode a case number or filing reference and stamp it in the footer of each page for traceability.

For more control over the QR code before stamping, such as setting error correction levels or adjusting the output size, configure a QrOptions object and pass it to QrWriter.Write before calling StampToExistingPdfPage.

For more QR code generation patterns, explore the C# QR Code Generator tutorial and the full IronQR feature set.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 60,166 | Version: 2026.3 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronQR
run a sample watch your URL become a QR code.