Last updated: 04/17/15 01:30 pm EDT
PurposeThis 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.
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:
- 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.
- 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.
- 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.
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
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.
Under Manage Instance, select Instance Settings.
In the Instance Settings page, click Report Printing.
Select Oracle REST Data Services for Print Server. Click Apply Changes.
Click Sign out to log out of Application Express.
Click Return to Sign In 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 your login credentials and click Sign In.
In the Application Builder drop down, select Database Applications.
Click Create >.
Enter PDF Report Printing for Name and click Next >.
Click Create Application.
Click Create Application.
Navigate to PDF Report Printing application. Click Create Page.
Click Report icon.
Click Classic Report icon.
Enter OEHR_EMPLOYEES for Page Name and Region Name. Click Next
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
On Create Classic Report window for Table/View Name select OEHR_EMPLOYEES. Click Next
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.
Click the Attributes under the OEHR_EMPLOYEES report.
In the Property Editor - Attributes section, select Yes to Enable Report Printing.
Click Save and Run Page.
Enter your login credentials. Click Log In.
Scroll down on the Oehr Employees report page and click Print.
Click OK to open and view the PDF version of the report.
The pdf report is displayed.
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
Lead Curriculum Developer: Dimpi Sarmah