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: generate a QR bitmap with QrWriter.Write().Save(), load the PDF with PdfDocument.FromFile, then call DrawBitmap with x and y coordinates in PDF points and explicit width and height to control the stamp size precisely.

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

  • AnyBitmap qrBitmap = QrWriter.Write("hello world").Save();
  • PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
  • pdf.DrawBitmap(qrBitmap, pageIndex: 0, x: 505, y: 20, desiredWidth: 70, desiredHeight: 70, pixelFormat: PixelFormat.Format32bppArgb, ignorePageRotation: false);

Code Explanation

QrWriter.Write generates the QR code and Save() returns it as an AnyBitmap. The bitmap is passed to DrawBitmap on the loaded PdfDocument. The x and y values are in PDF points from the top-left corner (an A4 page is 595 × 842 pts), and desiredWidth and desiredHeight set the stamped size precisely — here 70 × 70 pts places a compact QR at the top-right corner. Call pdf.SaveAs() to write the result.

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 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.