Displaying pdf from file system in OA framework pages

Hi,
If anyone could help me with this I would be very grateful.
We have a number of pdfs containing sensitive information, held on our Unix file system in directories not publicly available.
I want to create an OA framework page which takes the name of a pdf as a parameter and displays the content of that pdf on the user's browser. I cannot simply do a redirect because the pdfs are not publicly available.
I've found some sample java code that allows you to set InputStream and OutputStream and read the content of the file. However, I cannot see how to redirect the output stream to the browser. Of course, this may be entirely the wrong approach.
Can anyone suggest anything or point me to some documentation that might help?
Many thanks,
Mike Thorn.

Hi Shiv,
Thanks for responding. I'm not sure whether I've explained my problem properly, so I've included a code snipet below.
I've got my head around how to stream the contents of a file to an output string but cannot see how to bolt this into the controller region for an OA framework page. In the code below, you'll see I have a dofile which reads from my D: drive and streams to the System.out. I'm calling this from the processRequest for the page controller but do not understand how to get the output stream into the OAHTMLWebBean (my inclusion of Google works just fine).
All this Java is rather new to me I'm afraid.
public static void dofile()
try{
OutputStream outStream = System.out;
String fileName= (String)"index.htm";
String filePath = "D:\\Jdeveloper\\jdevdoc\\";
File f = new File(filePath, fileName);
String fileType = fileName.substring(fileName.indexOf(".")+1,fileName.length());
byte[] buf = new byte[8192];
FileInputStream inStream = new FileInputStream(f);
int sizeRead = 0;
while ((sizeRead = inStream.read(buf, 0, buf.length)) > 0) {
outStream.write(buf, 0, sizeRead);
inStream.close();
outStream.close();
     catch (Exception e) {
          System.err.println(e);
          System.err.println("dofile error");
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
dofile(); //but how do I egt the output to the OAHTMLWebBean?
// the following works fine to include Google
OAHTMLWebBean outRegion = (OAHTMLWebBean)createWebBean(pageContext, HTML_WEB_BEAN, null, "IFRAME");
outRegion.setHTMLAttributeValue("src","http://www.google.co.uk");
outRegion.setHTMLAttributeValue("width", "100%");
outRegion.setHTMLAttributeValue("height", "60%");
outRegion.setHTMLAttributeValue("title","My title");
outRegion.setHTMLAttributeValue("name", "My name");
pageContext.getPageLayoutBean().addIndexedChild(outRegion);
Many thanks again for any help you can offer this Java virgin,
Mike Thorn

Similar Messages

  • Add content from File System Repository in Web Page Composer developed page

    Hello,
    I want to use content from the File System Repository in Web Page Composer rather than uploading it again and again in Site Content folder. I see use of Entry Point for this but not sure how to use it and point to File System properly.
    regards
    Jaish

    Hello jaish,
    I think u can achive ur desire through Indexing kindly choose typr of index to be used.
    [Type Of Index|http://help.sap.com/saphelp_nw70/helpdata/EN/3e/07074260486024e10000000a1550b0/frameset.htm]
    regards.
    Soni Vinit
    Edited by: Vinit Soni on Sep 17, 2008 7:01 AM

  • Procedure to Insert PDF from FIle System to Database

    Hi ,
    I have a requirement to put the pdf files from our Local Machine or File system into Database table ..
    For that I have created a directory called "MY_PDF" with create and replace directory .
    Also , I have created a database table to store the files from Local machine FIle System directory ( MY_PDF) .
    I have created a procedure which takes 2 inputs ( ID and FIlename ) as parameters , this procedure when executes , it insert the file along with the ID in the database table .
    Procedure is as follows :
    CREATE OR REPLACE PROCEDURE proc_load_a_file( p_id IN NUMBER, p_filename IN VARCHAR2 )
    AS
    l_blob BLOB;
    l_bfile BFILE;
    x VARCHAR2(1000);
    BEGIN
    x:=p_filename;
    INSERT INTO demo(id,theblob,filename) VALUES ( p_id, empty_blob() ,x)
    RETURNING theBlob INTO l_blob;
    UPDATE demo
    SET locater =l_blob where id=p_id;
    l_bfile := bfilename( 'MY_FILES', p_filename );
    DBMS_LOB.FILEOPEN( l_bfile );
    DBMS_LOB.LOADFROMFILE( l_blob, l_bfile,
    DBMS_LOB.getlength( l_bfile ) );
    DBMS_LOB.fileclose( l_bfile );
    COMMIT;
    END;
    Now , my requirement is not to insert one one file each and every time when I execute the procedure .
    My requirement is first to check the File system Directory (MY_PDF) . If
    there is any pdf file in the directory then it will call that procedure and insert that file into the database untill no files found in the dorectory ( MY_PDF) .
    I am not getting the idea how to do this ..
    Please someone provide some valueable inputs .. so that I can finish it up .
    Thanks
    Prashant Dwivedi

    Suggest using the FlowElement.setStyle method to attach additional information about the image to the InlineGraphicElement that gets created.  Looking at the example code in the posted link you'll need to pass that data to the imageLoadComplete method.  The InlineGraphicElement can be found by saving interactionManager.absoluteStart before the graphic is inserted and then calling textFlow.findLeaf(savedAbsoluteStart).
    Hope that helps,
    Richard

  • Oracle reports to display PDF/Excel files stored in the Database

    can we use Oracle reports to view/display PDF/Excel files stored in the Database? Thanks Lalitha

    A document stored in the database can be easily retrieved in or via the browser using mod_plsql. Simplified:
    select content, mime_type
    into v_blob, v_mime_type
    from ...
    owa_util.mime_header(nvl(v_mimetype,'application/octet'),false);
    htp.p('Content-length: ' || dbms_lob.getlength(v_blob));
    owa_util.http_header_close;
    wpg_docload.download_file(v_blob);So, the link in your report should point to this database procedure.
    Edited by: InoL on Mar 1, 2011 4:17 PM

  • Store \ Retrieve files from file system

    Hi to all!
    I would like to implement a solution for storing files uploaded via apex user interface to servers file system. As well I would like this files to be retrievable by apex users. I designed the following solution:
    For upload:
    1. Through file browse item user chooses file to be uploaded
    2. File goes to custom table (as BLOB)
    -- so far i would use apex Upload\Download files tutorial
    3. File(BLOB) would then have to be written to file system to some directory and file id would have to be written to some db table which holds pointers to files on file system
    4. delete file(blob) from custom table (from step 2)
    For download:
    1. user chooses link from some report region(based on table giving file pointers to files residing on file system)
    2. file identified with chosen file pointer is then inserted into blob column of some custom table in db
    3. from custom table with download procedure fie is finally presented to user
    4. delete file(blob) from custom table (from step 2)
    Using apex tutorial for Upload\Download files it is straitforward to get the files from db table or into db table using blobs. But i have not seen any example of using BFILE or migrating files from db to file system and vice versa.
    So some Q arise:
    a) How can I implement step 3 under For upload section above
    b) How can I implement step 2 under For download section above
    c) Is there any way to directly upload file to file system via apex user interface or to directly download file from file system via some report region link column?
    Please help!!!
    Regards Marinero
    Message was edited by:
    marinero

    marinero,
    Here is a procedure that will copy an uploaded file to the file system:
      Procedure BLOB_TO_FILE(p_file_name In Varchar2) Is
        l_out_file    UTL_FILE.file_type;
        l_buffer      Raw(32767);
        l_amount      Binary_Integer := 32767;
        l_pos         Integer := 1;
        l_blob_len    Integer;
        p_data        Blob;
        file_name  Varchar2(256);
      Begin
        For rec In (Select ID
                              From HTMLDB_APPLICATION_FILES
                             Where Name = p_file_name)
        Loop
            Select BLOB_CONTENT, filename Into p_data, file_name From HTMLDB_APPLICATION_FILES Where ID = rec.ID;
            l_blob_len := DBMS_LOB.getlength(p_data);
            l_out_file := UTL_FILE.fopen('UPDOWNFILES_DIR', file_name, 'wb', 32767);
            While l_pos < l_blob_len
            Loop
              DBMS_LOB.Read(p_data, l_amount, l_pos, l_buffer);
              If l_buffer Is Not Null Then
                UTL_FILE.put_raw(l_out_file, l_buffer, True);
              End If;
              l_pos := l_pos + l_amount;
            End Loop;
            UTL_FILE.fclose(l_out_file);
        End Loop;         
      Exception
        When Others Then
          If UTL_FILE.is_open(l_out_file) Then
            UTL_FILE.fclose(l_out_file);
          End If;
      end; And here is a procedure that will download a file directly from the file system:
      Procedure download_my_file(p_file In Number) As
        v_length    Number;
        v_file_name Varchar2(2000);
        Lob_loc     Bfile;
      Begin
        Select file_name
          Into v_file_name
          From UpDownFiles F
         Where File_id = p_file;
        Lob_loc  := bfilename('UPDOWNFILES_DIR', v_file_name);
        v_length := dbms_lob.getlength(Lob_loc);
        owa_util.mime_header('application/octet', False);
        htp.p('Content-length: ' || v_length);
        htp.p('Content-Disposition: attachment; filename="' || SUBSTR(v_file_name, INSTR(v_file_name, '/') + 1) || '"');
        owa_util.http_header_close;
        wpg_docload.download_file(Lob_loc);
      End download_my_file;I could put a sample application on apex.oracle.com, but it wouldn't be able to access the file system on that server.

  • Can't Create PDF "from file" using any MS Office files

    Acrobat 8.1.1 Pro. (OS = XP), as part of the CS3 premium edition.
    I can no longer get Acrobat to recognize any of the MS Office applications extensions (.doc, .ppt, etc...) for use with either Create PDF "From File" or when using the Combine Files feature to Merge or Package. The extensions are no longer even listed as an option in the dialog box, or in the Preference settings under "Convert to PDF".
    FYI- I can still use the PDF Maker functionality from within the MS Office application to create a PDF.
    Any Idea what could have happened, or more importantly how to fix?
    ***Update***
    I have re-installed the Acrobat 8 application, and the problem still exists.
    I'm truly puzzled.

    I get this with my PC and I ran detect-repair and reinstalled. Some PDF's I can open and other's I cannot. I can send the email to a cohort and they can open fine.
    "Can't create file: Right-click the folder you want to create the file in and then click Properties on the shortcut menu to check your permissions for the folder"
    Any ideas would be great.
    Thanks!

  • Why did my Acrobat 9 stop being able to create PDFs from files?

    Howdy folks- my first foray here.
    I have a copy of acrobat pro 9 which I installed and used uneventfully for the last few years (windows 7). I hadn't used it in the last few months.
    Yesterday when I tried to create a new PDF from file (word doc, per usual) it gave me an error after 'opening the program the file was created in'. then it said PDFmaker or something like that wasnt working, did i want to run in repair mode?
    I said yes, waited about a half hour for it to do its repair thing, and it still didnt work. restarted twice. tried repairing again and restarting. same errors. then i uninstalled and reinstalled acrobat 9, and it still gives the same error, asking me to run in repair mode.
    i really need to be able to convert doc to PDF and there is no way i can afford a new copy. does anyone have any idea of how i can make this work again?
    thanks,
    anthony

    Sounds like you upgraded (or maybe just updated) your Office. If you updated to OFFICE 2010, then you will have to open the file in WORD and print to the Adobe PDF printer. PDF Maker for AA 9 is not compatible with OFFICE 2010.
    If you are talking about OFFICE 2007 or earlier, and OFFICE update may have disabled the PDF Maker macro. In that case, you have to open WORD and go to the oddins option and activate the PDF Maker option. It might be possible to get the feature back by opening Acrobat and using Help>Repair to repair your installation.

  • Creating PDF from File, missing Settings

    Acrobat Professional. 6.0.
    I never used Acrobats "Create PDF from file", as in my MS Office 2000 there was "Acrobat - Convert to Adobe PDF" menu item with the possibility to change joboptions settings.
    My current MS Office 2007 now has its own PDF convertor only, so I tried the Acrobats feature "Create PDF from file". It works, but the Settings button is grayed out with all Office file types. I didnt find a way how to access Acrobats settings, so I tried by first opening Distiller and changing the options there. Nothing happened, the output from Acrobat has always the same file size and quality. Of course I could make PDF out from Office by printing to Adobe PDF printer, but how with other file types which are not Office types.
    Thanks for suggestions, i.e. for showing me what I eventually didnt consider.

    As I and Bernd tried to say. AA6 does not support OFFICE 2007. The fact that you have PDF Maker from AA6 working in WORD 2007 is surprising. Since it is not a normal or supported operation, we have no idea what to tell you. It should not even be working. You are the first one I have ever heard say that they have the AA6 PDF Maker (create PDF is the way it shows up) working in OFFICE 2007!
    Thus, I may misunderstand. But I am trying to tell you that none of us have experience with the configuration. Adobe will also tell you to simply upgrade. Unfortunately, that leaves you on your own to experiment. If you have questions along the way based on your observations, we would be glad to try to help, but don't expect too much.

  • How to display PDF BLOB file within Forms

    Hi All:
    I just want to know if is it possible to display PDF blob file within the forms. Currently I use webutil to open pdf in browser. This time I need to display it in forms, so that upon scrolling, the user can view the pdf images of that particular record.
    TIA

    Hello,
    <p>Did you see this Java Bean ?</p>
    Francois

  • How to read some images from file system with webdynpro for abap?

    Hi,experts,
    I want to finish webdynpro for abap program to read some photos from file system. I may make MIMES in the webdynpro component and create photos in the MIMES, but my boss doesn't agree with me using this way. He wish me read these photos from file system.
    How to read some images from file system with webdynpro for abap?
    Thanks a lot!

    Hello Tao,
    The parameter
       icm/HTTP/file_access_<xx>
    may help you to access the pictures without any db-access.
    The following two links may help you to understand the other possibilities as well.
    The threads are covering BSP, but it should be useful for WebDynpro as well.
    /people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
    http://help.sap.com/saphelp_sm40/helpdata/de/c4/87153a1a5b4c2de10000000a114084/content.htm
    Best regards
    Christian

  • Issue from file system

    <font face="Times New Roman" color="35349F" size="3">
    Hi,
    during the setup of R12, there are some messages from File system
    http://dl.dropbox.com/u/40211031/f135.jpg
    the messages are in this log
    http://dl.dropbox.com/u/40211031/log2.txt
    how to resolve this?
    </font>

    Hua,
    during the setup of R12, there are some messages from File system
    http://dl.dropbox.com/u/40211031/f135.jpg
    the messages are in this log
    http://dl.dropbox.com/u/40211031/log2.txt
    how to resolve this?What is your OS?
    Can you click on the file system icon and see what is the error?
    Thanks,
    Hussein

  • How to migrate 11gr2 standby database from file system to ASM

    Hi,
    I have 11gR2 data guard setup of 2 node RAC primary and stand alone standby database.
    Primary RAC uses ASM, and stand alone standby DB uses normal file system for data files and archive logs. I want to migrate the stand alone standby DB from file system to ASM.
    If you have any ideas or documents on it, kindly please share with me.
    Thanks in advance,
    Mahipal

    Mahi wrote:
    Hi Fran,
    Thanks a lot for the quick reply. I have another question, I want to have standby in ASM; but ASM home is grid home(CRS+ASM) in 11gr2.
    I don't want to configure CRS now for standby, only want to have ASM storage. s it possible to install the grid home only for ASM and not for CRS?
    On a stand-alone system, there are still CRS/Grid components that are a part of the ASM install. You cannot NOT install it.
    >
    Thanks,
    Mahi

  • Why can't I load plugins from file system ?

    Hello.
    Why can't I load plugins from file system, fore development sake for ex. ?
    Thx.
    Andrew.

    For security reasons, the Flash Player doesn't allow applications to access both the file system and the network.
    One workaround is to compile the plugins in statically (rather than load them dynamically).  The Akamai Plugin Sample shows you how to load plugins either way, you can see the source here: http://opensource.adobe.com/svn/opensource/osmf/trunk/apps/samples/plugins/AkamaiPluginSam ple/.

  • Q: InDesign Extension could not be removed from file system when it was removed in Extension Manager

    <body>
    <p>All files of an ordinary extension will be removed from file system when this extension is removed in Extension Manager. But InDesign extensions with <tt>"plugin-manager-type"</tt> attribute in mxi file are special. Extension Manager will NOT remove files of this kind of extensions from file system when removing these extensions. Instead, Extension Manager will use other way to tell InDesign not to load these removed extensions when InDesign is launched. If you want to make your InDesign extensions removable, you can just remove <tt>"plugin-manager-type"</tt> attribute from the mxi file when you generate an extension.</p>
    </body>

    Thanks for the help. Yes that addressed the issue.
    On a side note, the tutorial I followed was the one that came with the plugin. Specifically I'm referring to the following file:
    //<eclipse_path>/plugins/com.adobe.cside.html.docs_1.0.0.201307260955/doc/getting_started/ Create_Your_Own_HTML5_Extension_In_5_Minutes.htm
    This is the HTML page for the "Create Your Own HTML5 Extension In 5 Minutes" walkthrough. It makes no mention of changing "PlayerDebugMode". I downloaded the eclipse plugin from the following link:
    http://labs.adobe.com/downloads/extensionbuilder3.html
    Is there a more up to date plugin? Where is the documentation that references changing the settings you mentionned?

  • Cannot Display PDF from Documentum in SAP

    Hello Everyone,
    We have linked SAP with Documentum to be able to retrieve documents stored in the content server. We made all the setting required in OAC0, OAC2, OAC3. But when we are posting a document against a Purchase Order from documentum and trying to view that PDF from "ME23" it is giving us an error message as shown below:-
    "The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    An invalid character was found in text content. Error processing resource 'file:///C:/Documents and Settings/gopal.yarlagad...
    But if we go into the "OAOR" I can see the document against the Purchase order. We are not able to figure out the issue regarding this. I would greatly appreciate your help if you can help me in resolving this issue.
    Regards,
    Gopal.

    We also had the same issue. It was working prior, and suddenly we can't view .msg file (in CMOD archived storage) in portal as it no longer recognize mime type for this. This must be a new patch from outlook last week. We ended up implementing config change suggested in note 1840170, and add this mime entry in local registry. As per IBM note http://www-01.ibm.com/support/docview.wss?uid=swg21610741, it looks like there's no other choice but to do it.
    We plan to push this entry to all users' computers soon. 
    Regards.

Maybe you are looking for