Sample code for 30+ languages & platforms
Tcl Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

#  This example requires the Chilkat API to have been previously unlocked.
#  See Global Unlock Sample for sample code.

set json [new_CkJsonObject]

set fmt [new_CkFormats]

set jsonOut [new_CkJsonObject]

set success [CkFormats_QrCode $fmt "capabilities" $json $jsonOut]
if {$success == 0} then {
    puts [CkFormats_lastErrorText $fmt]
    delete_CkJsonObject $json
    delete_CkFormats $fmt
    delete_CkJsonObject $jsonOut
    exit
}

puts "Chilkat version: [CkJsonObject_stringOf $jsonOut productVersion]"
puts "symbology: [CkJsonObject_stringOf $jsonOut {symbologies[0].id}]"
puts "QR versions: [CkJsonObject_IntOf $jsonOut {symbologies[0].encoding.version.min}] to [CkJsonObject_IntOf $jsonOut {symbologies[0].encoding.version.max}]"
puts "structured append, most symbols: [CkJsonObject_IntOf $jsonOut {symbologies[0].structuredAppend.maxSymbols}]"

set n [CkJsonObject_SizeOfArray $jsonOut "symbologies[0].encoding.errorCorrection"]
for {set i 0} {$i <= [expr $n - 1]} {incr i} {
    CkJsonObject_put_I $jsonOut $i
    puts "error correction: [CkJsonObject_stringOf $jsonOut {symbologies[0].encoding.errorCorrection[i]}]"
}

#  The operations this version implements.
set n [CkJsonObject_SizeOfArray $jsonOut "operations"]
for {set i 0} {$i <= [expr $n - 1]} {incr i} {
    CkJsonObject_put_I $jsonOut $i
    if {[CkJsonObject_BoolOf $jsonOut "operations[i].available"] == 1} then {
        puts "operation: [CkJsonObject_stringOf $jsonOut {operations[i].name}]"
    }

}

set n [CkJsonObject_SizeOfArray $jsonOut "imageFormats.output"]
for {set i 0} {$i <= [expr $n - 1]} {incr i} {
    CkJsonObject_put_I $jsonOut $i
    puts "image format: [CkJsonObject_stringOf $jsonOut {imageFormats.output[i]}]"
}

puts "default timeout: [CkJsonObject_IntOf $jsonOut limits.timeoutMs.default] ms"
puts "default largest image: [CkJsonObject_IntOf $jsonOut limits.maxPixels.default] pixels"

#  Sample output:

#  Chilkat version: 11.7.0
#  symbology: qr
#  QR versions: 1 to 40
#  structured append, most symbols: 16
#  error correction: auto
#  error correction: L
#  error correction: M
#  error correction: Q
#  error correction: H
#  operation: generate
#  operation: measure
#  operation: validate
#  operation: capabilities
#  image format: png
#  image format: svg
#  default timeout: 10000 ms
#  default largest image: 16777216 pixels

delete_CkJsonObject $json
delete_CkFormats $fmt
delete_CkJsonObject $jsonOut