IRONSOFTWAREHOME
Stamp QR Code to PDF
using IronQr;
using IronPdf;
using IronSoftware.Drawing;

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

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

// Stamp the QR code onto the first page at position x=505, y=20 (top-right corner)
pdf.DrawBitmap(qrBitmap, pageIndex: 0, x: 505, y: 20, desiredWidth: 70, desiredHeight: 70, pixelFormat: PixelFormat.Format32bppArgb, ignorePageRotation: false);

// Save the modified PDF
pdf.SaveAs("output.pdf");
Imports IronQr
Imports IronPdf
Imports IronSoftware.Drawing

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

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

' Stamp the QR code onto the first page at position x=505, y=20 (top-right corner)
pdf.DrawBitmap(qrBitmap, pageIndex:=0, x:=505, y:=20, desiredWidth:=70, desiredHeight:=70, pixelFormat:=PixelFormat.Format32bppArgb, ignorePageRotation:=False)

' Save the modified PDF
pdf.SaveAs("output.pdf")
NuGet Download
PM > Install-Package IronQR
Stamp QR Code to PDF

Stamp QR Code to PDF

Stamping a QR code directly onto an existing PDF page embeds scannable information without restructuring the document. IronQR handles this in three steps: create a QrWriter, generate the QR code with Write, then call StampToExistingPdfPage with the PDF path and the x and y coordinates that position the stamp on the chosen page.

3-step guide for stamping a QR code into a PDF

  • QrWriter writer = new QrWriter();
  • QrCode myQr = writer.Write("hello world");
  • myQr.StampToExistingPdfPage("sample.pdf", 505, 20, 0, "");

Code Explanation

QrWriter.Write generates the QR code and returns a QrCode. Calling StampToExistingPdfPage on that QrCode stamps it directly onto the source PDF, taking the PDF path, the x and y position, the zero-based pageIndex, and the PDF password (empty here). The x and y values position the stamp on the page - 505, 20 places it near the top-right corner.

Common use cases include embedding payment links on invoices, adding verification codes to legal documents, and placing tracking IDs on event tickets. For size-to-data tradeoffs, configure a QrOptions object with a different error correction level and pass it to QrWriter.Write.

Explore How to Stamp QR Codes into PDF Pages with IronQR.

Ready to Get Started?

Nuget Downloads 74,386Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required