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.

