Create barcodes in Oracle Reports using the Native JavaScript Barcode Generator

< Back
You are here:
Print

Create barcodes in Oracle Reports using the Native JavaScript Barcode Generator

The tutorial describes how to use IDAutomation’s JavaScript Barcode Generator to create barcodes in Web Layout Mode for Oracle Reports. Because native JavaScript is used, no additional components, fonts or plug-ins need to be installed to create barcodes; the code is the complete barcode generator.

Solution(s):

This example is based on Oracle Reports Web Layout Mode using IDAutomation’s JavaScript Barcode Generator to create a Code 128 barcode, and it assumes a basic knowledge of Oracle Reports. For more information on using the JavaScript Barcode Generator, please visit: https://www.idautomation.com/barcode-components/javascript/

  1. Create a Web report or use Reports Builder Wizard and select either the “Create both Web and Paper Layout” or “Create Web Layout Only” option.
  2. Add the following line at the top of the file just before the </head> line to load the appropriate JavaScript file:
    <script language=”JavaScript” src=”IDAutomation_JavaScriptBarcode_C128.js”></script>
  3. Place the IDAutomation_JavaScriptBarcode_C128.js. in the folder that contains the .jsp file.
  4. Add a script where the barcode is to appear in the HTML document or text object, which is the file name without the “.js”:
    <script type=”text/javascript”>
    document.write(IDAutomation_JavaScriptBarcode_C128(DataToEncode))
    </script>
  5. Modify “DataToEncode” with what is to be encoded in the barcode. This may be accomplished with a “variable” in JavaScript or a dynamically generated webpage. Additional properties may be modified if necessary.
  6. To preview the report output in a Web browser, choose Program >> Run Web Layout. This immediately displays the effect of the changes on the output.
  7. The symbology may be changed if necessary according to the JavaScript Barcode Generator User Manual.