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
Go to Shared Components
Navigate to Static Application Files
Upload the downloaded
JsBarcode.all.min.jsfile
Step 3: Reference the JavaScript File in Your Page
Open the target page in Page Designer
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
Post a Comment