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.
Subscribe to my newsletter
Read articles from Rodrigo Mesquita directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Rodrigo Mesquita
Rodrigo Mesquita
Rodrigo is a Senior Oracle Developer at QV Systems. He is an experienced software engineer with emphasis in analysis, design and development of bespoke Oracle applications utilising development tools such as APEX, PL / SQL, jQuery, javaScript, CSS and JSON for a variety of international businesses. Rodrigo speaks regularly at Oracle community events and enjoys creating APEX plugins and writing blogs.