Generating QR Codes Using Delphi – DelphiZXingQRCode – Open Source Unit by Debenu

A QR code (Quick Response Code) is a specific 2D barcode that gained popularity during the last years when mobile phones with cameras allowed mobile phone users to quickly scan the image and get more info on a product, business, event, offer, URL address, …

If you need to include the generation of QR barcode images in your Delphi application, you might want to take a look at Debenu’s open source “DelphiZXingQRCode” – a Delphi port of the QR Code functionality in ZXing, an open source barcode image processing library.

QR codes are used to encode URL, text or other data. Most smartphones like iPhones and Android phones have apps that let you to read QR codes. When your mobile reads (scans) a QR Code, the QR code will then send you to a website or online voucher or an online business card.

There are several Delphi-style QR code implementations but only a few are free and/or include source code.

DelphiZXingQRCode is a single-unit implementation you simply add to your (new or) existing project, set a few properties and paint the image. DelphiZXingQRCode (for the moment) supports auto, numeric, alphanumeric, ISO-8859-1, UTF-8 without Bom and UTF-8 with Bom encoding.

Just a few lines of code, TDelphiZXingQRCode related, and your QR is ready:

  QRCode: TDelphiZXingQRCode;
  Row, Column: Integer;
  QRCode := TDelphiZXingQRCode.Create;
    QRCode.Data := edtText.Text;
    QRCode.Encoding := TQRCodeEncoding(cmbEncoding.ItemIndex);
    QRCode.QuietZone := StrToIntDef(edtQuietZone.Text, 4);
    QRCodeBitmap.SetSize(QRCode.Rows, QRCode.Columns);
    for Row := 0 to QRCode.Rows - 1 do
      for Column := 0 to QRCode.Columns - 1 do
        if (QRCode.IsBlack[Row, Column]) then
          QRCodeBitmap.Canvas.Pixels[Column, Row] := clBlack;
        end else
          QRCodeBitmap.Canvas.Pixels[Column, Row] := clWhite;

If you only need the image generated out of your application, you might want to try this fantastic free online QR Code Generator from the ZXing Project.

What Delphi-style QR generator are you using? Have something Delphi-style to read QR Codes?

5 thoughts on “Generating QR Codes Using Delphi – DelphiZXingQRCode – Open Source Unit by Debenu

  1. Pingback: Generate QR codes using Firemonkey in Dephi XE-5 | Delphi Firemonkey, Delphi Android, Delphi IOS

  2. Andreas

    is there any library in delphi that i can use it to do the opposite. like if i have an image of QR Code, can i extract the information like url, text, etc behind the code?

Comments are closed.