Skip to main content

Command Palette

Search for a command to run...

Generating Barcodes in Oracle APEX with the APEX_BARCODE Package

Updated
Generating Barcodes in Oracle APEX with the APEX_BARCODE Package

The apex_barcode package offers a PL/SQL API to generate various types of barcodes. You can output barcodes as SVG (Scalable Vector Graphics) values or as PNG file blobs, making it easy to embed them in your APEX apps, reports, or documents.

Generating a PNG barcode

declare
  l_output blob;
begin
  l_output := apex_barcode.get_code128_png(
                  p_value            => 'https://apexblog.dev/',
                  p_scale            => 1,
                  p_foreground_color => '#4cd964',
                  p_background_color => '#c7c7cc' );

end;

Generating a SVG barcode

declare
  l_output clob;
begin
  l_output := apex_barcode.get_code128_svg(
                  p_value            => 'https://apexblog.dev/',
                  p_foreground_color => '#4cd964',
                  p_background_color => '#c7c7cc' );

  dbms_outout.put_line( l_output );
end;

We can also generate in a EAN8 format using apex_barcode.get_ean8_png and apex_barcode.get_ean8_svg

Embedding barcodes in APEX pages

  • for svg: use a pl/sql dynamic content region to output the svg directly.

  • for png: store the blob in a table and use an image item or blob download link to display or let users download the barcode.

In conclusion, the apex_barcode package in Oracle APEX 24.2 provides a robust and flexible solution for generating barcodes in your applications. With support for both SVG and PNG outputs, it caters to a wide range of needs, whether for web integration, print, or other systems. By leveraging this PL/SQL-driven package, you can easily embed barcodes in APEX pages. Whether you need to display barcodes directly on a page or allow users to download them, the apex_barcode package simplifies the process, making it an essential tool for modern APEX dev.

More from this blog

A

APEX Blog

33 posts