• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
        • Image Statement
        • Image.load Function
        • Image.save Function
        • Image.width Function
        • Image.height Function
        • Image.resample Function
        • Image.createQRCode Function
        • Image.takePhoto Function
        • Image.captureSignature Function
        • Image.view Function
        • Image.clear Function
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Image.createQRCode Function

Format
b = image_name.createQRCode(qr_code_text,
                           
ʃerrorCorrection := ecc,ʅ
                           
ʃscale := scale,ʅ
                           
ʃquietZone := quiet_zone,ʅ
                           
ʃdarkColor := dark_color,ʅ
                           
ʃlightColor := light_colorʅ);
Description
The Image.createQRCode function creates a QR code and sets the contents of the Image object to this image. The text for the QR code, qr_code_text, can be specified using a string or numeric expression.
Using named arguments, you can control how the QR code is created:
  • errorCorrection := error correction level, specified as a string expression evaluating to one of four levels: "low" ‖ "medium" ‖ "quartile" ‖ "high". The higher the level, the larger the dimensions of QR code, as well as the increased likelihood that a partially corrupted QR code can be read. In addition to the words, the level can be specified using single letters: "L" ‖ "M" ‖ "Q" ‖ "H". (Default setting: medium.)
  • scale := the number of pixels per "module," specified as a numeric expression. The value cannot be less than 1, and the higher the value, the larger the dimensions of the QR code. (Default setting: 4.)
  • quietZone := the "quiet zone" (margin) around the QR code, specified as a numeric expression in "modules." The value cannot be less than 4. (Default setting: 4. Using the default scale and quiet zone results in a margin of 4 x 4 = 16 pixels.)
  • darkColor := the color of the dark areas, specified as a string expression evaluating to a HTML color name (like "red") or a hex color code (like "#ff0000"). (Default: black.)
  • lightColor := the color of the light areas, specified as a string expression. (Default: white.)
The dimensions of the created QR code image are not known prior to creation as they depend in part on the length of the input text, as well as the error correction level.
This function is similar to the Barcode.createQRCode function.
Return Value
The function returns a logical value of 1 (true) if the QR code was successfully generated, or 0 (false) on error.
Example 1
Image cspro_80_barcode;
cspro_80_barcode.
createQRCode("Thanks for using CSPro 8.0!");
cspro_80_barcode.
view();
Example 2
Image csentry_apk_url;
csentry_apk_url.
createQRCode("https://play.google.com/store/apps/details?id=gov.census.cspro.csentry",
                             
errorCorrection := "quartile",
                             
scale := 6,
                             
quietZone := 8,
                             
darkColor := "white",
                             
lightColor := "green");
csentry_apk_url.
view();
See also: Image Object, Barcode.createQRCode Function, Barcode.read Function