Lazarus Pascal Requires Chilkat v11.7.0+
Lazarus Pascal
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 Lazarus Pascal Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Formats,
Chilkat.JsonObject;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
json: TJsonObject;
fmt: TFormats;
jsonOut: TJsonObject;
i: Integer;
n: Integer;
begin
success := False;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
json := TJsonObject.Create;
fmt := TFormats.Create;
jsonOut := TJsonObject.Create;
success := fmt.QrCode('capabilities',json,jsonOut);
if (success = False) then
begin
WriteLn(fmt.LastErrorText);
Exit;
end;
WriteLn('Chilkat version: ' + jsonOut.StringOf('productVersion'));
WriteLn('symbology: ' + jsonOut.StringOf('symbologies[0].id'));
WriteLn('QR versions: ' + jsonOut.IntOf('symbologies[0].encoding.version.min') + ' to ' + jsonOut.IntOf('symbologies[0].encoding.version.max'));
WriteLn('structured append, most symbols: ' + jsonOut.IntOf('symbologies[0].structuredAppend.maxSymbols'));
n := jsonOut.SizeOfArray('symbologies[0].encoding.errorCorrection');
for i := 0 to n - 1 do
begin
jsonOut.I := i;
WriteLn('error correction: ' + jsonOut.StringOf('symbologies[0].encoding.errorCorrection[i]'));
end;
// The operations this version implements.
n := jsonOut.SizeOfArray('operations');
for i := 0 to n - 1 do
begin
jsonOut.I := i;
if (jsonOut.BoolOf('operations[i].available') = True) then
begin
WriteLn('operation: ' + jsonOut.StringOf('operations[i].name'));
end;
end;
n := jsonOut.SizeOfArray('imageFormats.output');
for i := 0 to n - 1 do
begin
jsonOut.I := i;
WriteLn('image format: ' + jsonOut.StringOf('imageFormats.output[i]'));
end;
WriteLn('default timeout: ' + jsonOut.IntOf('limits.timeoutMs.default') + ' ms');
WriteLn('default largest image: ' + jsonOut.IntOf('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
json.Free;
fmt.Free;
jsonOut.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.