Creating PDF Reports with Oracle Application Express 5.0 and Oracle REST Data Services


Options



Last updated: 04/17/15 01:30 pm EDT

Overview

Purpose

This tutorial covers how to create PDF reports using the Oracle REST Data Services and Oracle Application Express 5.0.

Time to Complete

Approximately 20 minutes.

Introduction

You can configure a classic report region to print by exporting it to several different formats such as Adobe Portable Document Format (PDF), Microsoft Word Rich Text Format (RTF), or Microsoft Excel Format (XLS), or Extensible Markup Language (XML). Oracle Application Express provides three report printing configuration options. They are:

  1. Oracle REST Data Services (ORDS): Select this option if you are using Oracle REST Data Services 2.0 or newer. This option enables you to use the basic printing functionality, which includes creating report queries and printing report regions using the default templates provided in Application Express and using your own customized XSL-FO templates.
    Note: The Oracle REST Data Services (ORDS) option does not require an external print server, instead the report data and stylesheet are downloaded to the listener, rendered into PDF format by the listener and then sent to the client. The PDF documents in this setup are not returned back to the database, thus the print APIs are not supported when using the Oracle Application Express Listener - based configuration.
  2. External (Apache FOP): Select this option if you are using Apache FOP on an external J2EE server. This option enables you to use the basic printing functionality, which i8ncludes creating report queries and printing report regions using the default templates provided in Application Express and using your own customized XSL-FO templates.
  3. Oracle BI Publisher: This option requires a valid license of Oracle BI Publisher. This option enables you to take report query results and convert them from XML to RTF format using Oracle BI Publisher. Select this option to upload your own customized RTF or XSL-FO templates for printing reports with Oracle Application Express.

In this tutorial, you use the Oracle REST Data Services (ORDS) of a classic report. APEX Listener for PDF printing has the FOP libraries actually built into the listener thereby making the configuration setup easy. You log into the APEX Instance Administration, select Oracle REST Data Services (ORDS) as the Print Server, and then enable PDF printing for Classic Reports, Interactive Reports, or Report Queries.

Prerequisites

Before starting this tutorial, you should have:

  • Access to an Oracle Database 11g database or above that has the sample schema installed.
  • Installed Oracle Application Express Release 5.0 into your Oracle Database.
  • Installed Oracle REST Data Services (ORDS) 2.0 or higher.
  • Downloaded and unzipped the files.zip into your working directory.
  • Access to the OEHR tables. If necessary, install OEHR Sample Objects present in the files.zip folder downloaded in the above step.

Logging Into Oracle Application Express as an Instance Administrator and Setting up the Print Server

In this topic, you log into Oracle Application Express as an Instance Administrator and select Oracle REST Data Services (ORDS) as Print Server. This step is not required to be performed if Print Server is already setup to Oracle Rest Data Services while configuring Oracle APEX 5.0 instance

  1. On the Application Express Login page, select Administration in the Workspace section.
    Note: Alternatively, in a web browser, navigate to the Oracle Application Express Administration Services application. For example, http://hostname: port/apex/apex_admin. The Login page appears.

    Enter admin for Username. For Password, enter the Instance administrator account password you specified when you installed Oracle Application Express. Click Sign In to Administration. Note: admin is the default Instance administrator account. You can also create additional Instance administrator accounts.

  2. Under Manage Instance, select Instance Settings.

  3. In the Instance Settings page, click Report Printing.

    alt description here
  4. Select Oracle REST Data Services for Print Server. Click Apply Changes.

    alt description here
  5. Click Sign out to log out of Application Express.

    alt description here
  6. Click Return to Sign In Page.

    alt description here

Creating a Classic Report in a Database Application

In this topic, you create a classic report in a database application which can then be used to print by exporting it to PDF format.

  1. Log into Application Express using your login credentials. Enter your login credentials and click Sign In.

    alt description here
  2. In the Application Builder drop down, select Database Applications.

    alt description here
  3. Click Create >.

    alt description here
  4. Enter PDF Report Printing for Name and click Next >.

    alt description here
  5. Click Create Application.

    alt description here
  6. Click Create Application.

    alt description here
  7. Navigate to PDF Report Printing application. Click Create Page.

    alt description here
  8. Click Report icon.

    alt description here
  9. Click Classic Report icon.

    alt description here
  10. Enter OEHR_EMPLOYEES for Page Name and Region Name. Click Next

    alt description here
  11. On Navigation Menu window for Navigation Preference, select Identify an existing navigation menu entry for this page. For Existing navigation Menu Entry select Home from select list. ClickNext

    alt description here
  12. On Create Classic Report window for Table/View Name select OEHR_EMPLOYEES. Click Next

    alt description here
  13. Click Next

    alt description here
  14. Click Create

    alt description here

Enabling PDF Printing for the Classic Report

In this topic, you enable PDF printing for the classic report you have created in the previous topic.

  1. In the application's home page, click OEHR_EMPLOYEES page.

    alt description here
  2. Click the Attributes under the OEHR_EMPLOYEES report.

    alt description here
  3. In the Property Editor - Attributes section, select Yes to Enable Report Printing.

    alt description here
  4. Click Save and Run Page.

    alt description here
  5. Enter your login credentials. Click Log In.

    alt description here
  6. Scroll down on the  Oehr Employees report page and click Print.

    alt description here
  7. Click OK to open and view the PDF version of the report.

    alt description here
  8. The pdf report is displayed.

    alt description here

Summary

In this tutorial, you have learned how to:

  • Log into Application Express as an Instance Administrator and set up the Print server
  • Create a Classic Report in a Database Application
  • Enable PDF Printing for the Classic Report

Resources

Credits

  • Lead Curriculum Developer: Dimpi Sarmah