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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Display blob from database on Apex page

newjackDec 27 2018 — edited Jan 4 2019

Hello,

In Apex 5, we have a requirement to have several documents stored as blobs in the database be displayed on an apex page somehow, possibly in a region with the <embed> tag. Searching the forums hasn't revealed a solution.

We tried using the common code snippet

SELECT doc_image, DBMS_LOB.GETLENGTH(doc_image), doc_filename

INTO v_blob , v_length, v_filename

FROM test_download_doc

WHERE doc_id = to_number(i_doc_id);

--

-- set up HTTP header

--

-- use an NVL around the mime type and

-- if it is a null set it to application/octect

-- application/octect may launch a download window from windows

owa_util.mime_header( nvl(v_mime,'application/pdf'), FALSE );

-- set the size so the browser knows how much to download

htp.p('Content-length: ' || v_length);

-- the filename will be used by the browser if the users does a save as

htp.p('Content-Disposition: inline; filename="'||replace(replace(substr(v_filename,instr(v_filename,'/')+1),chr(10),null),chr(13),null)|| '"');

-- close the headers

owa_util.http_header_close;

-- download the BLOB

wpg_docload.download_file( v_blob );

end download_doc;

but that only resulted in the below when trying to render the pdf from the above approach.

bad_pdf.png

Any guidance would be appreciated.

This post has been answered by raudabat on Jan 4 2019
Jump to Answer

Comments

Processing

Post Details

Added on Dec 27 2018
4 comments
1,468 views