Implementing a Barcode Generator in Oracle APEX

Steps to Implement Barcode Generation in Oracle APEX




Step 1: Download the JsBarcode Library

Download the JsBarcode JavaScript file from the official GitHub release page:
https://github.com/lindell/JsBarcode/releases/latest/download/JsBarcode.all.min.js


Step 2: Upload the JavaScript File as a Static Application File

  1. Go to Shared Components

  2. Navigate to Static Application Files

  3. Upload the downloaded JsBarcode.all.min.js file


Step 3: Reference the JavaScript File in Your Page

  1. Open the target page in Page Designer

  2. Under JavaScript → File URLs, add the static file reference, for example:

    #APP_FILES#JsBarcode.all.min.js
    
    


Step 4: Initialize JsBarcode on Page Load

Add the following JavaScript code to the Execute when Page Loads section:

JsBarcode(".barcode").init();




Step 5: Create a Report with Barcode SVG

Create a Classic Report (or Interactive Report) and use the following SQL query:

SELECT
    prod_name,
    '<svg class="barcode"
        jsbarcode-format="CODE128"
        jsbarcode-value="' || bar_code || '"
        jsbarcode-text="' || bar_code || ' - ' || prod_name || ' - ' || prod_id || '"
        jsbarcode-textmargin="0"
        jsbarcode-fontoptions="bold">
    </svg>' AS barcode_svg
FROM products;

Step 6: Disable Escape Special Characters

For the BARCODE_SVG column:

  • Set Escape Special Characters to No

This ensures the SVG barcode renders correctly.

    



Step 7: Save and Run the Page

Save your changes and run the page to see the generated barcodes.



Comments

Popular posts from this blog

Stripe Payment Gateway in Oracle APEX

Creating a Menu Popup in Oracle APEX Using Custom Attributes

Creating a Functional Button in an Oracle APEX Interactive Grid