12.6 GET_QRCODE_SVG Function

This function generates a QR code that is configured according to the specified options and returns a CLOB in SVG format.

Syntax

APEX_BARCODE.GET_QRCODE_SVG (
    p_value             IN VARCHAR2,
    p_size              IN NUMBER         DEFAULT c_default_size,
    p_quiet             IN NUMBER         DEFAULT c_default_quiet,
    p_eclevel           IN t_eclevel_type DEFAULT c_default_eclevel,
    p_foreground_color  IN VARCHAR2       DEFAULT c_default_foreground_color,
    p_background_color  IN VARCHAR2       DEFAULT NULL )
    RETURN CLOB;

Parameters

Parameter Description
p_value Value to be encoded into the QR code.
p_size Size of the QR code (in pixels). Defaults to 256px.
p_foreground_color Foreground color. Must be in hex format. Default #000000.
p_background_color Background color. Must be in hex format. Default null (transparent).
p_quiet Blank area (positive integer value) around the QR Code used to help the scanners clearly distinguish the QR code from its surroundings for good scannability. Defaults to 1.
p_eclevel

The error-correction level. The level determines the percentage of the total QR code that can be dirty or damaged and still be valid.

Default c_eclevel_type_high.

Possible values:

  • c_eclevel_type_low - 7% of data bytes can be restored.
  • c_eclevel_type_medium - 15% of data bytes can be restored.
  • c_eclevel_type_quartile - 25% of data bytes can be restored.
  • c_eclevel_type_high - 30% of data bytes can be restored.

Returns

The SVG value of the QR code.

Example

Generates an SVG QR code with a determined foreground and background color. This function is usually used in rendering QR code page item.

DECLARE
  l_output clob;
BEGIN
  l_output := apex_barcode.get_qrcode_svg(
                  p_value            => 'apex.oracle.com',
                  p_foreground_color => '#4cd964',
                  p_background_color => '#c7c7cc' );
  sys.dbms_outout.put_line( l_output );
END;