QR Codes in BI Publisher

GitHub

Introduction

QR Codes are machine-readable graphics that store information. This is usually the black and white square filled with a pixelated pattern that you can scan with your smartphone.The most common application is to encode a URL so the user can go directly to the target without hand-typing in the often-complex URL string.

However, at its basic root, it’s just a string of characters.

BI Publisher theoretically can print two types of codes: QR Codes and PDF417 codes.

QR Vs PDF417

QR Codes

QR Codes, or Quick Response Codes, are those Square black and white codes seen everywhere. Up to 7,089 characters can be encoded in one symbol. Most smartphones can read a QR Code using the camera app.

This one encodes https://peopletoolstechtips.com/

PDF417

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management. “PDF” stands for Portable Data File. The “417” signifies that each pattern in the code consists of 4 bars and spaces in a pattern that is 17 units (modules) long.

WikiPedia: https://en.wikipedia.org/wiki/PDF417

This code also encodes https://peopletoolstechtips.com/

A PDF417 code can hold up to 1,850 alphanumeric characters. Most smartphone do not natively read a PDF417 code unless using a specialized app.

BI Publisher QR Codes in PeopleSoft

PeopleSoft’s implementation of BI Publisher has been able to print QR and PDF417 codes since PeopleTools 8.58.

Only RTF templates can print QR and PDF417 codes. Excel and PDF templates do not yet print the codes.

At the time of this blog (December 2023) there is a java bug preventing PDF417 codes from printing.

Error generating report output: During calling method PTFOProcessor.generateOutput, the XDO engine throws an exception: oracle.xdo11g.xpath.XPathException: Extension function error: Error invoking 'pdf417':'java.lang.IllegalAccessError: failed to access class com.google.zxing.pdf417.encoder.PDF417 from class oracle.xdo.template.rtf.util.PDF417Util (com.google.zxing.pdf417.encoder.PDF417 and oracle.xdo.template.rtf.util.PDF417Util are in unnamed module of loader 'app')'.   (235,3101) (235,2309)

Add a QR/PDF417 Code to your RTF Template

Adding both QR Codes and PDF417 codes start the same way in BI Publisher.

  1. Open a RTF Template
  2. Select the BI Publisher item on the Menu Ribbon
  3. Load your sample XML File
  4. Layout your report
  5. Add the field to convert into a QR/PDF417 code to your template as a text field
  6. Preview and verify the field is showing properly as plain text.

QR Code Tag Syntax and Parameters

The BI Publisher XSL tag syntax for the QR Code is as follows:

<?qrcode: <DATA>; <SIZE>[; <CHARSET>]?>

• Data: Text to encode in a QR
• Size: Size of the QR Square in your document in points (pt)
• CharSet [optional] character set to encode (UTF8 is default)

Here’s a simple example of a QR Code declaration:

<?qrcode: fld_X_QRCODE_DATA; 200?>

The data in the fld_X_QRCODE_DATA field will be rendered in a square 200 points on a side.

Adding QR Codes in RTF Templates

Left click on the field to display as a QR Code to select and make active
Right click on this field to bring up the BI Publisher Properties dialog box

Click on the Advanced Tab to see the BI Publisher XSL field tag for this field

Edit this tag to add the QR designator to the tag

<?qrcode: fld_X_QRCODE_DATA; 200?>

Here’s how it looks in the properties box

Save and preview your template. This is the result of the our demonstration text field encoded in QR.

PDF417 Code Tag Syntax and Parameters

The BI Publisher XSL tag syntax for the PDF417 Code is as follows:

<?pdf417: <DATA>[; <XSCALE>[; <COLUMNS>[; <ROWS>[; <CHARSET>]]]]?>
  • Data: Text to encode in a QR
  • XScale [optional]: Point (pt) per internal module width. Default value is 1
  • COLUMNS [optional]: indicates the number of columns to be used in the generated PDF417 symbol. Default value is -1.
  • ROWS [optional]: indicates the number of rows to be used in the generated PDF417 symbol. Default value is -1.
  • CharSet [optional]: indicates the character set to be used to encode data with the Byte compaction mode. Specify CharSet only if the data contains non-Latin-1(ISO-8859-1) characters.

Here’s a simple example of a PDF417 Code declaration:

<?pdf417: fld_X_QRCODE_DATA; 3?>

The data in the fld_X_QRCODE_DATA field will be rendered in a rectangle with each data element 3 points.

PDF417 Codes in RTF Templates

Left click on the field to display as a PDF417 Code to select and make active
Right click on this field to bring up the BI Publisher Properties dialog box

Click on the Advanced Tab to see the BI Publisher XSL field tag for this field

Edit this tag to add the PDF417 designator to the tag

<?pdf417: fld_X_QRCODE_DATA; 3?>

Here’s how it looks in the properties box

Save and preview your template. This is the result of the demonstration text field encoded in PDF417.

Please note that the 3rd parameter in the PDF417 tag is very different from the 3rd parameter of the QR Code tag.

  • The QRCode tag SIZE parameter is required, the PDF417 XSCALE parameter is not.
  • The QRCode tag SIZE parameter defines the overall size of the whole QR Code
  • The PDF417 Tag XSCALE parameter defines the size of the individual data elements in the graphic.
  • Setting the PDF417 Tag XSCALE parameter to anything larger than 4 will most likely NOT fit on a page.

Previewing templates with QR and PDF417 codes

Depending on your version of BI Publisher Desktop, you may or may not be able to display the QR and PDF417 codes using BI Publisher Desktop Preview button. The BI Publisher Desktop version delivered with PeopleTools 8.60 can not display the output on their own.

There are several options around this problem:

Update BI Publisher Desktop to latest version

1) Download latest BI Publisher Desktop from Oracle

2) Download and install the latest java version

BI Publisher Template Viewer Utility

  1. Navigate to the BI Publisher executables directory. This location will vary depending on where you installed BI Publisher desktop helper and version installed (32/64-bit).

…\Program Files\Oracle\BI Publisher\TemplateViewer

2. Launch the template viewer utility

  1. Place your templates and sample XML files in the same work directory
  2. Set your working directory to the working directory
  3. Highlight the Data file and template to test
  4. Set your output type
  5. Click on the “Start Processing” button

Use PeopleTools Create BIP Report Definitions Preview

  • *Note: this will only work with QR Codes – not PDF417 codes as of PeopleTools 8.60 due to PDF417 Java bug.
  1. Register a BIP Data Source using your sample XML file
  2. Create a BIP Report Definition
  3. Upload your test template to the Template Tab
  4. Click the preview button to test the template with the sample XML File
  5. Results will pop up to a new browser tab

Reading QR Codes

Some thought needs to go into how your target users will read the QR Codes. Most smartphones will read QR codes natively but will need an app read PDF417 codes. The native apps will attempt to turn the data into something actionable such as a URL or phone number.

A QR code on a report is a call to action with a path to action. Here’s some ideas to include QR codes in your reports:

  • Encoding links to an Employee Self Service pages
  • Link to an employee action in Manager Self Service
  • Encode a link to an invoice with keys for customers or finance to directly reference.
  • Add a phone number you want the user to call.
  • Current price of an item

What doesn’t work with smartphones is codes that are not links or phone numbers. The app will try to find something in that code, which may not be correct such as interpreting a date time stamp as a phone number.

If your organization is using= reader equipment or apps then any appropriate text can be encoded.

Links for more info

PeopleBooks 8.60: RTF Templates

Oracle BI Publisher Desktop Helper Download

Java downloads

Randall Groncki

Oracle ACE ♠ PeopleTools Developer since 1996 Lives in Northern Virginia, USA

View all posts by Randall Groncki →