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!

Define dynamically the Filename of a PDF Report query

Alexis BOct 28 2021

Hello all !
I am using APEX 20.2 on a XE 18 base configured with ORDS
I used ORDS as "Print Server"
I have 1 report query "Test" and 1 report layout "Test"
I have a button in my application that submit the page and I have a branch to launch the Report Query URL when the button is clicked
f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=Test
So I have a Test.pdf that is download, all is OK and works fine

But my question is : Is it possible to change the filename of the pdf downloaded ?
I would like to have the filename based on an application ITEM, so I can amend it easily to be unique
I found the APEX_UTIL PL_SQL Package and tried to use it

APEX_UTIL.DOWNLOAD_PRINT_DOCUMENT (
p_file_name => 'Test_abcd',
p_content_disposition => 'attachment',
p_application_id => :APP_ID,
p_report_query_name => 'Test',
p_report_layout_name => 'Test',
p_report_layout_type => 'xsl-fo',
p_document_format => 'pdf');

But file download is not in a correct PDF format It seems I have a first part with my Datas at XML Format and below it is followed by the xsl-fo layout source code
I tried to add "p_print_server => 'http://XXX.XXX.XXX.XXX:8080/ords' " but result is the same

Thanks

Best regards,

Comments
Post Details
Added on Oct 28 2021
2 comments
1,826 views