Last updated on MARCH 08, 2017
Applies to:Oracle REST Data Services - Version 2.0.1 and later
Oracle Application Express (formerly HTML DB) - Version 4.2.2 and later
Information in this document applies to any platform.
Calling the Apex Listener FOP from the Apex Print API generates a 503 error and a corrupt PDF. This happens when using a custom PL/SQL process to call a Report Query whose layout is based on a custom XSLT-FO named column report layout.
When the report query is called directly, it works fine. So the custom XSL-FO layout works.
The custom XSL-FO layout does not work only when a PL/SQL call is made to generate a pdf.
The downloaded pdf file is corrupted which when opened in notepad shows HTML code which when rendered on a .html file shows "503 - Service Unavailable" error.
Example Apex code / steps to reproduce the problem:
1) Create a PL/SQL process on an application page run on submit.
2) This PL/SQL process refers to a 'Report Query' in the shared components section of the application.
3) The pdf document created as a result of this process contains a report ran in the called 'Report Query'.
4) The styling and layout of the pdf document is set up via a valid named column (XSL-FO) Report Layout.
l_document := APEX_UTIL.GET_PRINT_DOCUMENT
l_id := APEX_MAIL.SEND
p_to => '********@gmail.com',
p_from => '********@gmail.com',
p_subj => 'sending PDF via print API',
p_body => 'Please review the attachment.',
p_body_html => 'Please review the attachment.'
p_mail_id => l_id,
p_attachment => l_document,
p_filename => 'mydocument.pdf',
p_mime_type => 'application/pdf'
Note: To enable the APEX_UTIL print APIs for the APEX Listener:
1) Edit the default.xml file found in your APEX Listener config folder and add the following to default.xml:
2) Restart the APEX Listener.
See related document - Apex Listener 2.0 FOP Gives 404 Error When Called from APEX_UTIL.GET_PRINT_DOCUMENT [Doc ID 1554090.1]
Also, ensure networking services have been enabled on that database, so that outgoing util_htp requests are allowed.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms