APEX Office Print - how do I force creation of single PDF in ZIP file

17 views Asked by At

Context

I'm using the UC APEX Office Print - DA plugin to create customer statements. The query returns customers, invoices and invoice items for for formatting with a .docx template.

Depending upon open invoices, the query may return 0 to n customers, each customer creating 1 pdf document. When n > 1 the plugin will create a zip file for downloading that contains n pdf documents, one for each customer. This is the desired behavior.

The issue

The problem is when the query returns only 1 customer and only 1 pdf file is created. The single file is in PDF not ZIP format but downloaded as a zip file. If I rename the downloaded file to .pdf the content is correct.

Init PL/SQL:

aop_api_pkg.g_output_compression := aop_api_pkg.c_zip_zip;
aop_api_pkg.g_output_filename := '&P21_FILENAME.';
aop_api_pkg.g_output_remove_last_page := true;

Datasource snippet:

-- Create a unique-ish human relatable filename
select 
    'I_' || TO_CHAR(SYSDATE, 'YYYYMM') || '01-' || REGEXP_REPLACE(na.company_name,'[^A-Z]', '') || '.pdf' as "filename", 
    cursor(
      select

Environment

  • Oracle OCI hosted
  • Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.23.0.1.0
  • APEX Product Build 23.2.3
  • APEX Office Print 24.2
0

There are 0 answers