Reputation: 5958
I'm running Apex 19.2.
I have a pdf stored as blob file in a table. I'm trying to download the blob in a page process.
The process works fine however, the file doesn't download but gets displayed in the browser instead.
Can anyone help please ? I need the file to download and not show in the browser...
Here is my code :
File Blob; -- Blob content is set somewhere else...
sys.HTP.init;
sys.OWA_UTIL.mime_header(MimeType, FALSE);
sys.HTP.p('Content-Length: ' || DBMS_LOB.getlength(File));
sys.HTP.p('Content-Disposition: filename="report.pdf"');
sys.OWA_UTIL.http_header_close;
sys.WPG_DOCLOAD.download_file(file);
apex_application.stop_apex_engine;
Thanks, Cheers,
Upvotes: 1
Views: 4269
Reputation: 4659
Change this line:
sys.HTP.p('Content-Disposition: filename="report.pdf"');
To this:
sys.HTP.p('Content-Disposition: attachment; filename="report.pdf"');
Upvotes: 1
Reputation: 7033
By default this is an individual browser setting, a preference configurable by end users.
It does appear that it can be forced through the link/URL that generates the PDF:
Upvotes: 0