BarCodeWiz Logo

Keeping a constant size of QR Code 2D Barcodes

Keep same size of your QR Codes easily

  • If you publish a few QR Codes on the same site, it might happen that these will be of different sizes. This is due to the amount of data being encoded, error correction, and minimum symbol size

  • Two cells with data to encode. 

  • Same two cells encoded to QR Codes (no Symbol Size set)

  • These two cells are encoded to QR Code using Minimum Symbol Size set to 4.
  • Note: The size of symbol will automatically increase if too small for the data.

ACCESS

  • In our case, the formula is:

=QrCodeEncode([Table1.Field2],4) - "4" is the  Symbol Size switch.

  •  Also - set the following properties:

Font Name - BCW_QR

Font Size - 12

Can Grow - Yes

 

 

 


SQL Server Reporting Services (SSRS)

  • Same barcode data encoded in SSRS
  • No Symbol Size set

  • Same Barcode Data encoded with Symbol Size set to 4
  • Expression:

=Code.MyQrCode.Encode("Lorem Ipsum",4)


Crystal Reports

  • Same barcode data encoded in Crystal Reports
  • No Symbol Size set

 

  • Same Barcode Data encoded with Symbol Size set to 4
  • Formula:

 

  // This is the text you wish to encode. Replace "Hello..." with your own data.
  // For example: stringVar barcodeInput := {my_data_table.item_text}; 
  // 
  // If your data is a number or date, it must be converted to string using the ToText() function.
  // For example: local stringVar barcodeInput := ToText( {my_data_table.item_text}, 0, ""); 
local stringVar barcodeInput := "Lorem ipsum";

 // Minimum size of QR Code symbol.
 // Valid sizes are 1-40, where size 1 equals 21x21 modules per side and size 40 equals 177x177.
 // Note: Size of symbol will automatically increase if too small for the data.
local numberVar symbolSize := 4;            
	  
 // Error correction level allows a partially damaged barcode to be scanned successfully.
 // Valid values are 1-4, representing levels of L, M, Q, and H.
local numberVar errorCorrectionLevel := 1;

 // Allows input of special characters in format ^000 where 000 is decimal ASCII code. 
 // For example, ABC^009123^013^010 encodes "ABC[TAB]123[CARRIAGE RETURN][LINE FEED]".
 // To encode the actual caret ^, enter it twice: ^^
 // To encode FNC1, enter: ^F1
local booleanVar allowSpecialChars := true;

 // Determines what type of QR Code barcode to create.
 // Set fnc1Mode to 0 to create "regular" QR Code barcodes (default)
 // Set fnc1Mode to 1 to create GS1-QR barcodes.
 // GS1-QR barcodes require input to be in the format: "(NN)XXXXXX(NN)XXXXXXXXX",
 // where NN is a 2, 3, or 4-digit AI and XXXXXX is alphanumeric data to be encoded.
local numberVar fnc1Mode := 0; 

 // Thickness of quiet zone (space around barcode), in number of modules.
 // Note: Minimum quiet zone in QR Code is 4 modules. 
 // If you add a border (borderWidth > 0), ensure quietZoneWidth is 4 or larger.
 // Default value is 0 (no quiet zone)
local numberVar quietZoneWidth := 0; 

 // Thickness of border around barcode, in number of modules.
 // If using a border, ensure quietZoneWidth is 4 or larger.
local numberVar borderWidth := 0; 

 // Character encoding of your data input.
 // For example: UTF-8 | UTF-16 | ISO-8859-1 | ISO-8859-3 | ISO-2022-JP-2 
 // This setting should be set to UTF-16 (Unicode) for Crystal Reports 9 and newer
 // Crystal Reports automatically converts all input (from database fields, strings, etc) into UTF-16.
local stringVar characterInputEncoding := "UTF-16";

 // Character encoding for data encoded in the QR Code symbol. 
 // The recommended setting is UTF-8, which is the default for the majority of barcode scanners.
 // If you change the setting, be sure the scanner understands it.
local stringVar characterOutputEncoding := "UTF-8";


local numberVar strLen := Length(barcodeInput);
local stringVar hex;
local stringVar xvals := "0123456789ABCDEF";
local numberVar i;
For i := 1 to strLen Do
(
    local numberVar num := AscW(Mid(barcodeInput, i, 1));
    local numberVar first := Remainder( num,  256);
    local numberVar sec := Int( num / 256);

    hex := hex + Mid(xvals, Int(first/16) + 1, 1) + 
                 Mid(xvals, Remainder(first, 16) + 1, 1) + 
                 Mid(xvals, Int(sec/16) + 1, 1) + 
                 Mid(xvals, Remainder(sec, 16) + 1, 1);
);

local stringVar fullBarcode := "";
local numberVar partNumber := 0;

local stringVar result;
Do 
(
    result := QrCodeEncodeFromHex(partNumber, hex, symbolSize, errorCorrectionLevel, 
                                    allowSpecialChars, fnc1Mode, quietZoneWidth, borderWidth, 
                                    characterInputEncoding, characterOutputEncoding);
    fullBarcode := fullBarcode + result;
    partNumber := partNumber + 1;
)
While result <> "";

fullBarcode;