Creating PDF Reports with Oracle Application Express 4.2 and the APEX Listener

Overview

    Purpose

    This tutorial covers how to create PDF reports using the APEX Listener and Oracle Application Express.

    Time to Complete

    Approximately 30 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 Application Express Listener: Select this option if you are using the Oracle Application Express Listener 2.0 or higher. 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 Application Express Listener 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 APEX Listener for PDF printing 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 Application Express 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 4.2 into your Oracle Database.
    • Installed Oracle Application Express Listener 2.0 or higher.
    • Access to the OEHR tables. If necessary, download and install OEHR Sample Objects available from OTN at http://www.oracle.com/technetwork/testcontent/oehr-sample-objects-131098.zip

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 APEX Listener as Print Server.

    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 Login to Administration.
    Note: admin is the default Instance administrator account. You can also create additional Instance administrator accounts.

    Under Manage Instance, select Instance Settings.

    In the Instance Settings page, click Report Printing.

    Select Oracle APEX Listener for Print Server.

    Click Apply Changes.

    Click Logout to log out of Application Express.

    Click Return to Login Page.

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.

    Log into Application Express using your login credentials. Enter the following login credentials and click Login to Application Express.
    Note: Here, the Workspace, Username and Password used are obe.

    Workspace: OBE
    Username: OBE
    Password: obe

    In the Application Builder drop down, select Database Applications.

    Click Create.

    Enter PDF Report Printing for Name and click Next.

    Select Page Type as Report, select Table Name as OEHR_EMPLOYEES, and Implementation as Classic. Click Add Page.

    Click Create Application.

    Click Create Application.

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.

    In the application's home page, click Oehr Employees page.

    Right-click the OEHR_EMPLOYEES report and select Edit Print Attributes.

    Select Yes for Enable Report Printing and click Apply Changes.

    Click Run Page.

    Enter your login credentials. Enter obe for Username and obe for Password. Click Login.

    Scroll down on the  Oehr Employees report page and click Print.

    The file is saved. Open the file to view the PDF version of the report.

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: Anupama Mandya

To navigate this Oracle by Example tutorial, note the following:

Hide Header Buttons:
Click the title to hide the buttons in the header. To show the buttons again, click the title again.
Topic List:
Click a topic to navigate to that section.
Expand All Topics:
Click the button to show or hide the details for the sections. By default, all topics are collapsed.
Hide All Images:
Click the button to show or hide the screenshots. By default, all images are displayed.
Print:
Click the button to print the content. The content that is currently displayed or hidden is printed.

To navigate to a particular section in this tutorial, select the topic from the list.