46.4 GENERATE_DOCUMENT Function Signature 3
This function returns a document as BLOB using a pre-defined report query.
Syntax
APEX_PRINT.GENERATE_DOCUMENT (
p_application_id IN NUMBER,
p_data IN CLOB,
p_report_layout_static_id IN VARCHAR2,
p_output_type IN t_output_type DEFAULT c_output_pdf)
RETURN BLOB;
Parameters
Parameter | Description |
---|---|
p_application_id |
Defines the application ID of the report layout. |
p_data |
Report data. The format depends on the type of print server that is used. |
p_report_layout_static_id |
Static ID of the report layout (stored under application's shared components). |
p_output_type |
Defines the document format. See t_output_type for the available types in Constants.
|
Returns
A BLOB containing the generated document.
Example
The following example generates a PDF document using custom JSON and a report layout defined in an application.
DECLARE
l_document blob;
l_json sys.json_object_t := sys.json_object_t();
BEGIN
l_json.put( 'title', 'Hello World' );
l_document :=
apex_print.generate_document (
p_application_id => 100,
p_report_data => l_json.to_clob(),
p_report_layout_static_id => 'MY_REPORT_LAYOUT',
p_output_type => apex_print.c_output_pdf );
apex_http.download(
p_blob => l_document,
p_content_type => 'application/pdf',
p_filename => 'hello-world.pdf' );
END;
See Also:
ConstantsParent topic: APEX_PRINT