Skip to Main Content

SQL & PL/SQL

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!

Downloading a PDF document via blob won't open start acrobat on click

1004640Apr 22 2013 — edited Apr 29 2013
I'm experiencing a problem trying to get acrobat reader to open immediately when viewing a file stored as a blob is clicked. I am updating an old plsql webtoolkit app that stores pdf files in the database as a blob and displays them to the user in a frame. Download is achieved using wpg_docload.download_file() and the example provided by Oracle documentation. The download package body is:
BEGIN
  l_filename := SUBSTR(OWA_UTIL.get_cgi_env('PATH_INFO'), 2);
  
-- get mime type from db 
  SELECT blob_content,
         mime_type
  INTO   l_blob_content,
         l_mime_type
  FROM   documents
  WHERE  name = l_filename;
  
-- Add header
  HTP.init;
  OWA_UTIL.mime_header(l_mime_type, false);
  HTP.print('Content-Length: ' || DBMS_LOB.getlength(l_blob_content));
  HTP.print('Content-disposition: inline; filename="'|| l_filename ||'"');
  OWA_UTIL.http_header_close;
  
-- get document  
  WPG_DOCLOAD.download_file(l_blob_content);

EXCEPTION
  WHEN OTHERS THEN
    HTP.htmlopen;
    HTP.headopen;
    HTP.title('File Downloaded');
    HTP.headclose;
    HTP.bodyopen;
    HTP.header(1, 'Download Status');
    HTP.print('Download of ' || l_filename || ' failed.');
    HTP.print(SQLERRM);
    HTP.bodyclose;
    HTP.htmlclose;
END download;
All files will download okay but the acrobat container doesn't open right away and show a progress bar. It waits for the entire file to download, then opens the file. This becomes a bigger issue when the file size increases because it appears as though the site hangs until the document appears.

If I place a file on a site directory instead of inside the database, create a link to it and click it, acrobat opens right away and displays progress. I want to get the site to open blob stored files in adobe right away and show download progress as if the file was stored on a site folder.

Any ideas? Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 27 2013
Added on Apr 22 2013
1 comment
724 views