48.7 GENERATE_DOCUMENT Function Signature 6
Generates a document using a custom template stored in an OCI Object Storage Bucket and return the contents.
Can only be used when Oracle Document Generator Pre-built Function is configured as print server in the instance.
Syntax
APEX_PRINT.GENERATE_DOCUMENT (
p_application_id IN NUMBER,
p_report_query_static_id IN VARCHAR2,
p_template_type IN t_template_type,
p_template_bucket IN VARCHAR2,
p_template_namespace IN VARCHAR2,
p_template_object IN VARCHAR2,
p_output_type IN t_output_type DEFAULT c_output_pdf,
p_output_password IN VARCHAR2 DEFAULT NULL)
RETURN BLOB;
Parameters
| Parameter | Description |
|---|---|
p_application_id |
Defines the application ID of the report query. |
p_report_query_static_id |
Static ID of the report query (stored under application's Shared Components). |
p_template_type |
Type of the template. |
p_template_bucket |
Name of the Object Storage bucket. |
p_template_namespace |
Object Storage namespace. |
p_template_object |
Name of the Template Object in Object Storage. |
p_output_type |
The type of document. |
p_output_password |
The password to needed to open the generated document. PDF only. |
Example
The following example gets a PDF using a report query and a custom template stored in an OCI Object Storage Bucket.
declare
l_document blob;
begin
l_document :=
apex_print.generate_document (
p_application_id => 100,
p_report_query_static_id => 'MY_REPORT_QUERY',
p_template_type => apex_print.c_template_docx,
p_template_bucket => 'mybucket',
p_template_namespace => 'mynamespace',
p_template_object => 'mytemplate.docx',
p_output_type => apex_print.c_output_pdf,
p_output_password => '...put your password here...' );
apex_http.download(
p_blob => l_document,
p_content_type => 'application/pdf',
p_filename => 'hello-world.pdf' );
end;
Parent topic: APEX_PRINT