X

The Oracle APEX blog is your source for APEX news, technical tips and strategic direction

APEX 20.2 Report Printing - Use Oracle Analytics Cloud as a Print Server

Jason Straub
Consulting Member of Technical Staff

There have been numerous enhancements for report printing in APEX 20.2. You can read all about the new features here. One of the new features is the ability to configure an application to use a Remote Server for printing. In this release, the only supported Remote Server for printing is Oracle Analytics Publisher.

Oracle Analytics Publisher is included as part of Oracle Analytics Cloud (OAC). The Publisher included in OAC has a RESTful service that allows you to securely post a request for a document in various output formats by passing the XML data and template using multi-part form input. APEX 20.2 makes use of this RESTful API when you configure a remote print server and use it for printing in your applications. Although the built-in report printing capabilities of APEX 20.2 are robust, Oracle Analytics Publisher adds the ability to create reports in rich text format (RTF) and also allows you to create and use your own templates for pixel perfect reports.

This post will give you step by step instructions on how to use Oracle Analytics Publisher as a remote print server for an application in APEX 20.2.

Prerequisites

  • Oracle APEX 20.2 configured for outbound network and HTTPS access (on premises instructions – no additional configuration needed on Oracle Autonomous Database)
  • Oracle Cloud Infrastructure tenancy with access to Oracle Analytics Cloud

Create an Analytics Instance

Login to your Oracle Cloud Infrastructure tenancy and follow the steps below.

  1. Use the upper left hamburger menu to navigate to Analytics > Analytics Cloud
  2. Choose the appropriate Compartment and then click Create Instance
  3. Enter an Instance Name (required) and review defaults for Capabilities, Licensing, and Network Access. In this example, the only information entered is Instance Name, “oac”
  4. Click Create
  5. Wait for the instance to be fully provisioned. The large icon will turn from yellow to green and Access Information will show the URL for the instance.
  6. Copy the Access URL for the instance. You will use part of this URL to configure your APEX app to use a remote print server.

Figure 1: Create Analytics Instance

Figure 1: Create Analytics Instance

Figure 2: Copy Access URL

Figure 2: Copy Access URL

Create IDCS User for Authentication

The Oracle Analytics Publisher RESTful API included with Oracle Analytics Cloud uses Identity Cloud Service (IDCS) authentication with the Basic Auth scheme. To create an IDCS account for authentication, follow the steps below.

  1. Using the hamburger menu in the upper left, navigate to Identity > Federation
  2. If you don’t already have an Oracle Identity Cloud Service Identity Provider, click Add Identity Provider to add it
  3. Click on the name of the IDCS Identity Provider in the list
  4. Click the link for the Oracle Identity Cloud Service Console
  5. Click the User icon to go to the Users page
  6. Click Add
  7. Enter the required information, a last name and username/email address. For example, Publisher for last name and oapub_service_acct for username. You will need to uncheck “Use the email address as the user name.”
  8. Click Finish.
  9. On the next page, click Reset Password.
  10. Wait for the email at the address you provided and click Activate Account in the email
  11. Enter and confirm a password to use

Figure 3: Create IDCS Account

Figure 3: Create IDCS Account

Assign Account to the Analytics IDCS App

In order for the user to be able to access the RESTful service, it must be added to the application role ServiceAdministrator in the IDCS application of the Analytics instance.

  1. Navigate to Analytics > Analytics Cloud
  2. Click on the name of the Analytics instance
  3. Click Additional Details tab
  4. Click on the name next to IDCS App
  5. Click Application Roles tab
  6. Unroll the menu to the right of ServiceAdministrator role and choose Assign Users
  7. Click the check box next to the user created above and click OK

Create a Remote Print Server in APEX 20.2

New in APEX 20.2 is the ability to create a Remote Server reference to a print server at the workspace level. You can then configure any APEX app within this workspace to use that remote print server for report printing.  The Oracle Analytics Publisher RESTful service endpoint is /xmlpserver/services/rest/v1/format/render. To create a Remote Server reference to the service, use the URL you copied when creating the Analytics instance (removing /ui/) and add /xmlpserver/services/rest/v1/format/render.

  1. In an APEX 20.2 instance, navigate to Workspace Utilities > All Workspace Utilities > Remote Servers.
  2. Click Create.
  3. Enter the following details:
    1. Name: OA Publisher
    2. Static Identifier: OA_Publisher
    3. Server Type: Print Server
    4. Endpoint URL: <URL constructed with OA UI home and REST endpoint>
  4. Click Create.

Figure 4: Create Remote Print Server

Figure 4: Create Remote Print Server

Create Credentials for IDCS Account

Create Basic Auth credentials for the previously created IDCS account in Workspace Utilities.

  1. Navigate to Workspace Utilities > All Workspace Utilities > Web Credentials
  2. Click Create
  3. Enter the following details like the example below:
    1. Name: OA Publisher Basic
    2. Static Identifier: OA_Publisher_Basic
    3. Authentication Type: Basic Authentication
    4. Client ID or Username: oapub_service_acct
    5. Client Secret or Password: <Password used when verifying account>
  4. Click Create

Figure 5: Create Web Credentials

Figure 5: Create Web Credentials

Configure Application to Use Remote Print Server

New in APEX 20.2 is the ability to define Report Printing attributes for an application. You can either use built-in printing, print settings defined at the instance level, or a Remote Print Server. Create a new application with at least one interactive report or use an existing application and change the application definition to use a Remote Print Server.

  1. Create a new application with an interactive report or edit an existing application.
  2. Navigate to Shared Components > Application Definition Attributes.
  3. Click Report Printing tab to go to the Report Printing attributes.
  4. Choose Remote Print Server from the Print Server Type dropdown.
  5. Choose “OA Publisher” as Remote Print Server and “OA Publisher Basic” as Credentials
  6. Run the application and download an interactive report in various formats to validate that requests to the Oracle Analytics Publisher Remote Print Server are working.

Oracle Analytics Publisher also works with Report Queries and custom Report Layouts defined in Shared Components of an application.

Figure 6: Configure Application Definition Report Printing

Figure 6: Configure Application Definition Report Printing

Conclusion

It is easy to configure your APEX 20.2 applications to use Oracle Analytics Publisher included with Oracle Analytics Cloud to create high fidelity reports. Once you have created an Oracle Analytics instance and assigned an IDCS user to the application ServiceAdministrator role, you can then create a Remote Server and Web Credential in APEX 20.2 and then change the Report Printing attributes of your application to use the defined Remote Print Server.

For those customers familiar with BI Publisher integration configured at the instance level in APEX Administration Services, they will be able to leverage all of their existing report templates unchanged. Oracle Analytics Publisher is completely compatible with all the features previously built-in to APEX for BI Publisher such as Report Queries and Report Layouts.

You can take advantage of this new printing option in your on premises APEX 20.2 environment as well as in Oracle Cloud including Oracle Autonomous Database on shared Exadata infrastructure.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.