46.2 GENERATE_DOCUMENT Function Signature 1
This function generates a document based on data and a template and returns the contents.
Can only be used when Oracle Document Generator Pre-built Function is configured as print server in the instance.
To be used when printing a single document using a custom template, which is not stored as report layout.
Syntax
APEX_PRINT.GENERATE_DOCUMENT (
p_data IN CLOB,
p_template IN BLOB,
p_template_type IN t_template_type DEFAULT c_template_docx,
p_output_type IN t_output_type DEFAULT c_output_pdf )
RETURN BLOB;
Parameters
Parameter | Description |
---|---|
p_data |
Data for the document. Currently JSON format only. |
p_template |
Contents of the template. Currently only DOCX files. |
p_template_type |
Type of the template. Currently only c_template_docx .
|
p_output_type |
The type of document. Currently only c_output_pdf .
|
Returns
A BLOB containing the generated document.
Example
The following example generates a PDF document using an uploaded template and custom JSON data.
DECLARE
l_template blob;
l_data sys.json_object_t := sys.json_object_t();
l_document blob;
BEGIN
SELECT blob_content
INTO l_template
FROM apex_application_temp_files
WHERE name = :P1_TEMPLATE;
l_data.put( 'name', 'Scott' );
l_document := apex_print.generate_document(
p_data => l_data.to_clob,
p_template => l_template );
END;
Parent topic: APEX_PRINT