Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle Apex REST API response PDF compression

Arif Sher KhanJul 24 2024

Hi

I have a REST API (returns BLOB) which I call in Oracle Apex, and then that is downloaded in browser using following code

sys.HTP.init;
OWA_UTIL.mime_header( p_mimetype, FALSE, 'UTF-8' );
sys.HTP.p( 'Content-Disposition: attachment; filename="' || p_download_file_name || '"' );
sys.HTP.p( 'Content-length: ' || sys.DBMS_LOB.getlength( p_file_blob ) );
sys.OWA_UTIL.http_header_close;
v_output_blob := p_file_blob;
WPG_DOCLOAD.download_file( v_output_blob );
APEX_APPLICATION.stop_apex_engine;

This is working, but the file size is coming up too large sometimes, and I want to compress it.

I have tried UTL_COMPRESS.LZ_COMRESS, which do compress the size, but it make the BLOB unrenderable as PDF. I get an error when I try to open the downloaded file.

Using Oracle 19c, with 21.2 Apex

Any suggestions?

Comments
Post Details
Added on Jul 24 2024
1 comment
367 views