Home General

Swiss-QR

Hi,

I have a problem with the size of QR codes. With the Swiss payment slip, there is a requirement that the QR code must be exactly 46x46 mm in size. I can do that just fine with QR version 16.

As a sample, the QR code has the following data:
SPC
0200
1
CH0112342345345645675
S
Musterfirma GmbH
Musterstraße 21

9494
Musterhausen
CH







909.46
CHF
S
Maximilian Mustermann
Musterweg 89

9494
Musterdorf
CH
QRR
10293847000001234500000815
1

EPD
However, the validator reports an error and I was told that Software XYZ's code does not bring this error, but also uses QR version 11 and that I should now use QR version 11 as well, even though I know for a fact that it is is not the problem.

So I try version 11, but even though I have AutoScale active, the QR code remains significantly smaller than the desired total area.

Only when I increase the size to 50x50 mm does the QR code scale to the total area, but the default is 46x46 mm. Can you tell me how I can scale the QR code with millimeter precision according to the desired overall size, so that the QR code is filled with version 11 even with 46x46 mm?

Thanks very much!

mtlmarko89

Comments

  • Hi Marko,

    Which version of ReportBuilder and Delphi are you using? In my testing with your exact data, I was able to produce a QR Code (version 11) that was exactly 46mm x 46mm without issues. Below is my simple code.

    We have worked with some of our customers with similar EPC QR Codes successfully.

    1. Since it appears all Swiss QR Codes require UTF-8 encoding, be sure you have the QRCodeSettings.CharEncoding is set to UTF-8.

    2. By default, ReportBuilder adds a BOM (byte order mark) to all UTF-8 encoded barcodes. This is necessary for many readers to know which encoding to use. For EPC (and I assume Swiss QR) the BOM is not needed because the encoding is embedded in the QR data. Try setting the QRCodeSetting.IncludeBOM to False in code.
    uses
    ppTypes;

    procedure TForm2.Button1Click(Sender: TObject);
    begin
    pp2DBarCode1.QRCodeSettings.IncludeBOM := False;
    pp2DBarCode1.QRCodeSettings.CharEncoding := bceUTF8;

    pp2DBarCode1.Data := 'SPC' + #13#10 +
    '0200' + #13#10 +
    '1' + #13#10 +
    'CH0112342345345645675' + #13#10 +
    'S' + #13#10 +
    'Musterfirma GmbH' + #13#10 +
    'Musterstraße 21' + #13#10 +
    #13#10 +
    '9494' + #13#10 +
    'Musterhausen' + #13#10 +
    'CH' + #13#10 +
    #13#10 +
    #13#10 +
    #13#10 +
    #13#10 +
    #13#10 +
    #13#10 +
    #13#10 +
    '909.46' + #13#10 +
    'CHF' + #13#10 +
    'S' + #13#10 +
    'Maximilian Mustermann' + #13#10 +
    'Musterweg 89' + #13#10 +
    #13#10 +
    '9494' + #13#10 +
    'Musterdorf' + #13#10 +
    'CH' + #13#10 +
    'QRR' + #13#10 +
    '10293847000001234500000815' + #13#10 +
    '1' + #13#10 +
    #13#10 +
    'EPD';

    ppReport1.Print;

    end;
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,

    Version 19.04 Build 146 is in use. But unfortunately I can't get it to work in this version. Which version are you using that should work accordingly?

    What exactly do you have in the designer for the QR code object in the QRCodeSettings.CodeVersion property? Fixed an "11"? Or did you completely use the default settings and only switch the bare minimum to get a QR code (besides the code already shared)?

    Thanks for the help!

    Kind regards
    Marko
  • Hi Marko,

    >>But unfortunately I can't get it to work in this version.

    Do you mean it does not generate a barcode or the barcode is generated but cannot be verified? Note that I am not attempting to verify the barcode with any official verification software but I am checking the data for correctness.

    In my example, all changed properties are in code with the exception of AutoScale being set to True. The rest are default settings. All is done on the latest version of ReportBuilder (21.05).
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,

    by "But unfortunately I can't get it to work in this version" I just meant that it only gradually resizes the QR code. But at least I know that it's finally time to update to the current version.

    Thanks very much!
Sign In or Register to comment.