Documente Academic
Documente Profesional
Documente Cultură
Agenda
PDF Printing with APEX
Your Choices
Introducing Opal
Consulting
Building Web Applications for 12 years
Portal, Reports, OWA Toolkit, now APEX!
Why PDF?
What do we need PDF for?
Customers have reason to want print-quality
Forms, orders, invoices, proposals
Standard company reports (widely distributed)
Pixelperfect designs adhering to the corporate layout
High-end Reporting
Complex
Control over each pixel
Logos / images
Dynamic content
Hide / Show information conditionally
Authorization (internal / external view, e.g. proposal)
Why PDF?
Could use pl/pdf
Write plsql code to generate the report
Complexity is growing fast
Many lines of code with a lot of formatting information
Logic mixed with layout
Hard to maintain
Changing the report
Lack of easy formatting, alignment, grouping,
previews
Samples
Your Choices
URL Interfaces
PDF Generation
with APEX
JasperReports /
iReport Designer
Choose layout
Define basic print attributes declaratively
Which columns to include and their width
Header, footer, etc.
Fonts, sizes, colors, etc.
1
APEX
Client
J2EE Server
Pros
Dont have to rebuild a look-alike template
Business users can specify their reports
Expensive
Technically elegant solution
URL-Interfaces
Using ANY reporting engine that provides a web gateway
Crystal reports, Oracle Reports, etc.
http://<server>/<gateway>?
r=<reportName>&p=<parameters>&f=<reportFormat>
Problems:
Authentication Who am I?
Authorization May I run this report / see this data?
Apache /
mod_plsql
APEX
Client
J2EE / Tomcat
Report
Definition file
JasperReports
JasperReports
Very popular reporting engine (BIRT /
JasperReports)
Java library, to integrate / embed reporting
functions into your java application
Many open source projects and large
customers are using it and shipped as part
of JBOSS
JasperReports - Functions
Features
Data sources: JDBC, XML, OLAP, TEXT,
Multiple data sources per report
Output formats: PDF, XLS, HTML, CSV, TEXT, RTF, ODF
Matrix reports
Report trigger
Subreports / modularization
Reusuability / company header in a single file
JasperReports - Samples
JasperReports - Samples
JasperReports - Samples
iReport Designer
iReport Designer
Graphical editor to create the XML
definition file for JasperReports visually
Download
http://ireport.sourceforge.net/
Integration as external
report
Integration into your APEX application
Report definition in the J2EE application
Call from APEX
URL for the onDemandProcess
f?
p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=prc_show_url:::F_TMP_1:&F
_TMP_1.
xlib_http_pck.display_url_raw(p_url =>
'http://localhost:8080/jasperIntegration/report?_repName=Departments' ||
'&p_deptno=' || v('F_TMP_1'));
Integration
Implementing the HTTP
Tunnel
BEGIN
l_http_request := UTL_HTTP.begin_request (p_url);
Integration
Implementing the
Servlet
/ J2EE app
Skeleton
for implementing the servlet
// get a connection from the connection pool
ds = (DataSource) initContext.lookup("java:comp/env/jdbc/"
+ dataSource);
conn = ds.getConnection();
// fill the report with the data
jasperPrint = JasperFillManager.fillReport(reportFileName
+ ".jasper", reportParams, conn);
ServletOutputStream out = response.getOutputStream();
// Export the report into a PDF stream
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);
exporter.exportReport();
Summary
Dont program your reports !!!
JasperReports: cost-free, stable, performant and
flexible (API)
iReport Designer: cost-free, intuitive, powerful and
straightforward to use
Integration in APEX: easy and secure
RTF Export not perfect
Textfields / Frames not easy editable
No margins in the document
Still a learning curve, but not too steep
Q&A
Q&A
Contact: