Step 1: Classic Report (Source Page)
Sample Query
SELECT
file_id,
file_name,
'Preview' AS preview
FROM your_file_table;
Step 2: Create Preview Link
Edit the Preview column:
-
Type: Link
-
Target: Page in this Application (Modal Dialog Page) and make sure to set value
Step 3 : Create Modal Dialog Page
Step 4 : Create hidden Item : P_FILE_ID
Step 5: Create HTML Region (Iframe)
Add a Static Content region and paste:
<iframeid="pdfIframe"width="100%"height="800px"style="border:none;"></iframe>
Step 6: Load PDF on Page Load (JavaScript)
Add the following in Execute when Page Loads:
var fileId = apex.item("P_FILE_ID").getValue();if (fileId) {var url ='f?p=' +$v('pFlowId') +':0:' +$v('pInstance') +':APPLICATION_PROCESS=PREVIEW_PDF:::P_FILE_ID:' +fileId;document.getElementById('pdfIframe').src = url;}
Step 7: Create Application Process
Create an Application Process to stream the PDF and Make sure to same name should be in Execute javascript code .
Example :
DECLAREv_blob BLOB;v_file_name VARCHAR2(200);v_mime_type VARCHAR2(200);BEGINSELECT file_blob, file_name, mime_typeINTO v_blob, v_file_name, v_mime_typeFROM your_file_tableWHERE file_id = :P_FILE_ID;owa_util.mime_header(NVL(v_mime_type, 'application/pdf'),FALSE);htp.p('Content-Disposition: inline; filename="' ||v_file_name || '"');owa_util.http_header_close;wpg_docload.download_file(v_blob);END;

Comments
Post a Comment