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.
-
Install IronQR with NuGet Package Manager
PM > Install-Package IronQR -
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"); -
Deploy to test on your live environment
Start using IronQR in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronQR C# library to stamp QR codes into PDFs
- Generate a QR code bitmap using
QrWriter.Write().Save() - Load the PDF with
PdfDocument.FromFile() - Call
DrawBitmap()with page index, x/y coordinates, and size - Save the modified PDF with
SaveAs()
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.
: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")
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.
Page 1 input — QR code for ironsoftware.com/verify
Page 2 input — QR code for 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")
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.

