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!

Show PDF in new tab no need to download

VedantNov 19 2014

Hi Friends,

i am able to download PDF file from data base but we need if i click on image then pdf open in new tab.

i have refer below link

But i can't do this .

i have create same procedure which are mention in above

My code

create or replace PROCEDURE download_doc(i_doc_id in number) AS

v_mime VARCHAR2(48:= 'application/pdf';

v_length NUMBER;

v_filename VARCHAR2(200);

v_blob BLOB;

BEGIN

SELECT PDF_FILE, DBMS_LOB.GETLENGTH(PDF_FILE), PDF_FILE_NAME

INTO v_blob , v_length, v_filename

FROM INT_INTERJOURNAL_MAS

WHERE 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;


-------------------------------------------------------------------------

function open_pdf_doc() {

debugger;

var v_url = 'download_doc?i_doc_id=' + '&P4_DOC_ID.';

alert(v_url);

window.location.href = v_url;

}



where am i wrong?


My workspace details :


Work space : APEX_ISSUE

User NAme  : mano80kaushik@gmail.com

Passowrd   : kaushik123


Please help us.


Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2014
Added on Nov 19 2014
0 comments
888 views