PureBasic Requires Chilkat v11.7.0+
PureBasic
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 PureBasic Downloads
IncludeFile "CkFormats.pb"
IncludeFile "CkJsonObject.pb"
Procedure ChilkatExample()
success.i = 0
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
fmt.i = CkFormats::ckCreate()
If fmt.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
jsonOut.i = CkJsonObject::ckCreate()
If jsonOut.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkFormats::ckQrCode(fmt,"capabilities",json,jsonOut)
If success = 0
Debug CkFormats::ckLastErrorText(fmt)
CkJsonObject::ckDispose(json)
CkFormats::ckDispose(fmt)
CkJsonObject::ckDispose(jsonOut)
ProcedureReturn
EndIf
Debug "Chilkat version: " + CkJsonObject::ckStringOf(jsonOut,"productVersion")
Debug "symbology: " + CkJsonObject::ckStringOf(jsonOut,"symbologies[0].id")
Debug "QR versions: " + Str(CkJsonObject::ckIntOf(jsonOut,"symbologies[0].encoding.version.min")) + " to " + Str(CkJsonObject::ckIntOf(jsonOut,"symbologies[0].encoding.version.max"))
Debug "structured append, most symbols: " + Str(CkJsonObject::ckIntOf(jsonOut,"symbologies[0].structuredAppend.maxSymbols"))
i.i
n.i
n = CkJsonObject::ckSizeOfArray(jsonOut,"symbologies[0].encoding.errorCorrection")
For i = 0 To n - 1
CkJsonObject::setCkI(jsonOut, i)
Debug "error correction: " + CkJsonObject::ckStringOf(jsonOut,"symbologies[0].encoding.errorCorrection[i]")
Next
; The operations this version implements.
n = CkJsonObject::ckSizeOfArray(jsonOut,"operations")
For i = 0 To n - 1
CkJsonObject::setCkI(jsonOut, i)
If CkJsonObject::ckBoolOf(jsonOut,"operations[i].available") = 1
Debug "operation: " + CkJsonObject::ckStringOf(jsonOut,"operations[i].name")
EndIf
Next
n = CkJsonObject::ckSizeOfArray(jsonOut,"imageFormats.output")
For i = 0 To n - 1
CkJsonObject::setCkI(jsonOut, i)
Debug "image format: " + CkJsonObject::ckStringOf(jsonOut,"imageFormats.output[i]")
Next
Debug "default timeout: " + Str(CkJsonObject::ckIntOf(jsonOut,"limits.timeoutMs.default")) + " ms"
Debug "default largest image: " + Str(CkJsonObject::ckIntOf(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
CkJsonObject::ckDispose(json)
CkFormats::ckDispose(fmt)
CkJsonObject::ckDispose(jsonOut)
ProcedureReturn
EndProcedure