Products
PDFKit.NET 4.0
Created
11/10/2011
Tags
Generate PDF Shapes

This article shows how to generate a QR-code for a new or existing PDF document using the QRBarcodeShape.

About QR-Code

A QR code (Quick Response code) is a type of matrix barcode (or two-dimensional code) that consists of black modules arranged in a square pattern on a white background. The information encoded can be made up of any kind of data (e.g., binary, alphanumeric, or Kanji symbols).

C# code sample //create a QR barcode which points to tallcomponents.com. QRBarcodeShape qrBarcode = new QRBarcodeShape(); qrBarcode.Data = @"http://www.tallcomponents.com";

//make the QR barcode square qrBarcode.Width = qrBarcode.Height = 50; qrBarcode.Transform = new TranslateTransform(72, page.Height - 72 - qrBarcode.Height); page.VisualOverlay.Add(qrBarcode);

using (FileStream file = new FileStream("out.pdf", FileMode.Create, FileAccess.Write)) { document.Write(file); //save the pdf }]]>

VB.NET code sample 'create a QR barcode which points to tallcomponents.com. Dim qrBarcode As New QRBarcodeShape() qrBarcode.Data = "http://www.tallcomponents.com"

'make the QR barcode square qrBarcode.Width = qrBarcode.Height = 50 qrBarcode.Transform = New TranslateTransform(72, page.Height - 72 - qrBarcode.Height) page.VisualOverlay.Add(qrBarcode)

Using file As New FileStream("out.pdf", FileMode.Create, FileAccess.Write) 'save the pdf document.Write(file) End Using }]]>

This will create the following result: