58.64 GET_PRINT_DOCUMENT Function Signature 4
This function returns a document as BLOB
using XML based report data and RTF or XSL-FO based report layout.
Syntax
APEX_UTIL.GET_PRINT_DOCUMENT (
p_report_data IN CLOB,
p_report_layout IN CLOB,
p_report_layout_type IN VARCHAR2 DEFAULT 'xsl-fo',
p_document_format IN VARCHAR2 DEFAULT 'pdf',
p_print_server IN VARCHAR2 DEFAULT NULL )
RETURN BLOB;
Parameters
Parameter | Description |
---|---|
p_report_data |
XML based report data, must be encoded in UTF-8. |
p_report_layout |
Report layout in XSL-FO or RTF format. |
p_report_layout_type |
Defines the report layout type, that is "xsl-fo" or "rtf". |
p_document_format |
Defines the document format, that is "pdf", "rtf", "xls", "htm", or "xml". |
p_print_server |
URL of the print server. If not specified, the print server is derived from preferences. |
Example
The following example shows how to use the GET_PRINT_DOCUMENT
using Signature 4 (Document returns as a BLOB using XML based report data and RTF or XSL-FO based report layout). In this example, GET_PRINT_DOCUMENT
is used with APEX_MAIL
.SEND
and APEX_MAIL.ADD_ATTACHMENT
to send an email with an attachment of the file returned by GET_PRINT_DOCUMENT
. Both the report data and layout are taken from values stored in page items (P1_XML
and P1_XSL
).
DECLARE
l_id number;
l_document BLOB;
BEGIN
l_document := APEX_UTIL.GET_PRINT_DOCUMENT (
p_report_data => :P1_XML,
p_report_layout => :P1_XSL,
p_report_layout_type => 'xsl-fo',
p_document_format => 'pdf');
l_id := APEX_MAIL.SEND(
p_to => :P35_MAIL_TO,
p_from => 'admin@example.com',
p_subj => 'sending PDF by using print API',
p_body => 'Please review the attachment.',
p_body_html => 'Please review the attachment');
APEX_MAIL.ADD_ATTACHMENT (
p_mail_id => l_id,
p_attachment => l_document,
p_filename => 'mydocument.pdf',
p_mime_type => 'application/pdf');
END;
Parent topic: APEX_UTIL