Forum Stats

  • 3,769,358 Users
  • 2,252,956 Discussions
  • 7,874,999 Comments

Discussions

Oracle APEX Download PL/SQL Sub Region

Stephane Baribeau
Stephane Baribeau Member Posts: 60 Blue Ribbon

Hello,

I have a sub region on an Apex 19.2, i would like to download the code inside in pdf. I have an idea of chaging the mime-type of the page, but i would like to know the best way to do this. Does it possible to be done?

I have tryed some google int with htp.p() but that doesnt works! I can't use pl/sql package because the content can't be hold in a clob

Here is what i have tryed inside the subregion.

owa_util.mime_header('application/pdf', false);

htp.p('Content-Disposition: attachment; filename="myfile.pdf"');

owa_util.http_header_close;

but all this do is writing Content-Disposition... to the screen! :)

Any idea? Thanks for your help.

Tagged:

Comments

  • InoL
    InoL Member Posts: 9,341 Gold Crown
    edited Jun 10, 2021 2:50AM

    What you are trying to do is not possible this way. The mime header is, as the name suggests, page header information. You cannot use it in the middle of a page.

    I can't use pl/sql package because the content can't be hold in a clob

    Where is the source of the pdf then? (PDF is not a CLOB, but a BLOB)

    If it is on a web server somewhere, use  

    <iframe src="yourpath/yourfile.pdf" width="50%" height="500px"></iframe>
    


  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,594 Red Diamond

    You cannot "download the code inside in pdf".

    You need to use code to create a BLOB containing a valid PDF structure. Then you need to supply a URL reference to be used by the client to access the BLOB as a PDF file.

    This URL reference can be an APEX on-demand process that creates (using HTP.prn) formats a MIME header for a PDF data stream, stops the APEX flow engine, and streams the BLOB to the client. Basic example at https://community.oracle.com/tech/developers/discussion/comment/16782422#Comment_16782422

  • Stephane Baribeau
    Stephane Baribeau Member Posts: 60 Blue Ribbon

    thanks for all your answer. i will take a look at the apex on-demand process.

    I hope this will resolve my problem..

    Thanks again