To store PDF into BLOB and retrieve into OLE/OCX

We would like to:
1. Store a PDF file (output of a report saved in file server) into a BLOB
column.
2. Retrieve previously stored PDF in the BLOB column and display using either
OLE automation or ActiveX (OCX) control.
I read all related documents in metalink that addresses this issue however cant
get this to work. We have Acrobat Reader 4.0. Here are some issues from the
tests that I did:
1. To load the PDF file the program code that uses BFILE and LOADFROMFILE does
not work since the database is on a remote server and the PDF file is on a
local file server. The DIRECTORY created on the database is unable to find the
PDF file.
2. Though I want the loading of the file to be programmatic, I tried
right-click on the OLE container and inserted object from file. This loaded the
file into the container (Icon on the container appeared) however I was not able
to view the document by double-clicking. An error in Adobe occured: 'There was
an error opening this document. A file read error occured'. My guess is the
'Insert Object' did not insert the file properly into the BLOB.
3. When trying to display the PDF file stored in file server (in case storing
into BLOB does not work), I used an OCX control, right-clicked and Insert
Object and select Adobe Control for ActiveX. The problem here is when I run the
form, the OCX control shows up empty and I have to 'Insert Object' again in
runtime. Once I manually insert object from runtime the GET_INTERFACE POINTER &
SET_PROPERTY works fine is displaying the document. Is there any way to
maintain the control property of the OCX when the form is run?
4. Are there any workarounds and better solution to store PDFs into BLOBs and
retrieve and display in OLE/OCX controls? Using temporary file into local drive
is not an issue.
5. Would I be able to make use of 'PDF.PdfCtrl.1' OLE class?
6. Does OLE automation work for Acrobat Reader 4.0.?
I would appreciate all the help.
Shyam

Im facing a similar kind of problem. I want to store and retrieve Office files, PDF and Jpegs into/from the database to view them on web in disconnected mode. Please reply as I cant find any help/documentation regarding saving BLOB data into files. I was able to store file data into BLOB, using DBMS_LOB package.
Shahzad

Similar Messages

  • How to store pdf into blob, index it and search it?

    I am trying to store pdf into a column, index the column and search it.
    I store pdf file into blob column with either the following code or with an interface in apex
    declare
    Dest_loc BLOB;
    Src_loc BFILE := BFILENAME('DIR_TESTCASE', 'intermedia.pdf');
    BEGIN
    INSERT INTO pdffiles(id, description)
    VALUES(1, 'InterMedia Concepts')
    RETURN text INTO Dest_loc;
    DBMS_LOB.FILEOPEN(Src_loc, DBMS_LOB.LOB_READONLY);
    DBMS_LOB.LOADFROMFILE(Dest_loc, Src_loc, dbms_lob.getlength(Src_loc));
    DBMS_LOB.FILECLOSE(Src_loc);
    COMMIT;
    END;
    then i need to create an index
    begin
    ctx_ddl.create_preference('pdf
    lexer', 'BASICLEXER');
    ctx_ddl.set_attribute('pdf_lexer', 'printjoins', '_-');
    end;
    create index PDFFILES_TEXT on PDFFILES(TEXT) indextype is ctxsys.context
    parameters ('lexer pdf_lexer');
    sqlplus says index created but windows gives an error and closes ctxhx.exe
    and of cource when I tried to make a search like
    select id, description
    from pdffiles
    where contains(text,'Oracle') > 0;
    it doesn't return any results.
    My database is 10g XE, I also tried it on Oracle 10.2.0.3 EE

    It is possible to store pdf and doc files in a blob column, create a text index, and search them, and display them. However, you cannot expect to just select doc and pdf data directly from a blob column and expect to be able to read it, due to all of the special formatting characters. You need to use ctx_doc.snippet or ctx_doc.markup or some such thing to format it and make it readable. Please see the demonstration below. You can search the online documentation for complete syntax, additional information, and examples.
    SCOTT@orcl_11g> CREATE TABLE my_files
      2    (id   NUMBER,
      3       doc  BLOB)
      4  /
    Table created.
    SCOTT@orcl_11g> CREATE OR REPLACE DIRECTORY DIR_TESTCASE AS 'c:\oracle11g'
      2  /
    Directory created.
    SCOTT@orcl_11g> declare
      2    Dest_loc BLOB;
      3    Src_loc     BFILE;
      4  BEGIN
      5    INSERT INTO my_files (id, doc) VALUES (1, EMPTY_BLOB())
      6    RETURNING doc INTO Dest_loc;
      7    Src_loc := BFILENAME ('DIR_TESTCASE', 'banana.pdf');
      8    DBMS_LOB.FILEOPEN (Src_loc, DBMS_LOB.LOB_READONLY);
      9    DBMS_LOB.LOADFROMFILE (Dest_loc, Src_loc, dbms_lob.getlength (Src_loc));
    10    DBMS_LOB.FILECLOSE (Src_loc);
    11    INSERT INTO my_files (id, doc) VALUES (2, EMPTY_BLOB())
    12    RETURNING doc INTO Dest_loc;
    13    Src_loc := BFILENAME ('DIR_TESTCASE', 'test1.doc');
    14    DBMS_LOB.FILEOPEN (Src_loc, DBMS_LOB.LOB_READONLY);
    15    DBMS_LOB.LOADFROMFILE (Dest_loc, Src_loc, dbms_lob.getlength (Src_loc));
    16    DBMS_LOB.FILECLOSE (Src_loc);
    17  END;
    18  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> INSERT INTO my_files (id, doc)
      2  VALUES (3, UTL_RAW.CAST_TO_RAW ('blob data for id 3'))
      3  /
    1 row created.
    SCOTT@orcl_11g> COMMIT
      2  /
    Commit complete.
    SCOTT@orcl_11g> SELECT id, DBMS_LOB.GETLENGTH (doc) FROM my_files
      2  /
            ID DBMS_LOB.GETLENGTH(DOC)
             1                  222824
             2                   19968
             3                      18
    SCOTT@orcl_11g> CREATE INDEX my_files_idx ON my_files(doc)
      2       INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@orcl_11g> SELECT COUNT (*) FROM dr$my_files_idx$i
      2  /
      COUNT(*)
           308
    SCOTT@orcl_11g> COLUMN first_45 FORMAT A45
    SCOTT@orcl_11g> SELECT id,
      2           UTL_RAW.CAST_TO_VARCHAR2 (DBMS_LOB.SUBSTR (doc, 18, 1)) AS first_45
      3  FROM   my_files
      4  /
            ID FIRST_45
             1 %PDF-1.5
    %âãÏÓ
               1
             2 ÐÏࡱá
             3 blob data for id 3
    SCOTT@orcl_11g> EXEC CTX_DOC.SET_KEY_TYPE ('ROWID')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> COLUMN keywords_in_context FORMAT A45 WORD_WRAPPED
    SCOTT@orcl_11g> SELECT id,
      2           CTX_DOC.SNIPPET
      3             ('MY_FILES_IDX',
      4              ROWID,
      5              'contents OR (fruit of the month) OR data',
      6              '<<',
      7              '>>')
      8             AS keywords_in_context
      9  FROM   my_files
    10  WHERE  CONTAINS (doc, 'contents OR (fruit of the month) OR data') > 0
    11  /
            ID KEYWORDS_IN_CONTEXT
             1 <<Fruit of the Month>>
               Banana
               Bananas are the most popular
             2 This is the original <<contents>> of
               test1.doc.
             3 blob <<data>> for id 3
    SCOTT@orcl_11g>

  • Uploading PDF in to BLOB and Retrieve PDF from BLOB

    hi
    I have recently started working in apex and run into a bump while trying to handle PDF file Attachments and BLOBs.
    I am trying to upload a PDF file into BLOB database Column using APEX, and later view this file from DB.
    I require assistance on how to upload PDF file into BLOB, and how i can later view this inside the browser window, using APEX
    thanks

    Maybe this blog post can help you.
    Regards,
    Sergio

  • How to store images in database and retrieve them back to page?

    Well I don't know how to store an image file to a database (say MSSQL) from the JSP and retrieve it back whenever needed and put it on the JSP page? Please help me.

    I am not sure how to store images in database but what you can do is store the image into particular folder using FileOutputStream and its unique name into the database...and than retrieve it from the folder using that name retrieved from database...
    <%
    response.setContentType("text/html");
    response.setHeader("Cache-control","no-cache");
    String err = "";
    String lastFileName = "";
    String contentType = request.getContentType();
    String boundary = "";
    final int BOUNDARY_WORD_SIZE = "boundary=".length();
    System.out.println("contentType --> "+contentType);
    System.out.println("BOUNDARY_WORD_SIZE --> "+BOUNDARY_WORD_SIZE);
    if(contentType == null || !contentType.startsWith("multipart/form-data"))
    err = "Ilegal ENCTYPE : must be multipart/form-data\n";
    err += "ENCTYPE set = " + contentType;
    else
    boundary = contentType.substring(contentType.indexOf("boundary=") + BOUNDARY_WORD_SIZE);
    System.out.println("boundary --> "+boundary);
    boundary = "--" + boundary;
    try
    ServletInputStream sis = request.getInputStream();
    byte[] b = new byte[1024];
    int x=0;
    int state=0;
    String name=null,fileName=null,contentType2=null;
    java.io.FileOutputStream buffer = null;
    while((x=sis.readLine(b,0,1024))>-1)
         System.out.println("************ x ********** "+x);
         String s = new String(b,0,x);
                   System.out.println("************ s ********** \n"+s);
         if(s.startsWith(boundary))
         state = 0;
         System.out.println("name="+name);
         System.out.println("filename="+fileName);
         name = null;
         contentType2 = null;
         fileName = null;
         else if(s.startsWith("Content-Disposition") && state==0)
              System.out.println("-- 1 --");
              state = 1;
              System.out.println("s.indexOf(filename=) --> "+s.indexOf("filename="));
              if(s.indexOf("filename=") == -1)
                   name = s.substring(s.indexOf("name=") + "name=".length(),s.length()-2);
                   System.out.println("after name substring 1 "+name);
              else
                   name = s.substring(s.indexOf("name=") + "name=".length(),s.lastIndexOf(";"));
                   System.out.println("after name substring 2 "+name);
                   fileName = s.substring(s.indexOf("filename=") + "filename=".length(),s.length()-2);
                   System.out.println("fileName --> "+fileName);
                   //String fileName1 = s.substring(s.indexOf("filename=") + "filename=".length(),s.length());
                   //System.out.println("fileName1 -->"+fileName1);
                   if(fileName.equals("\"\""))
                   fileName = null;
                   else
                        String userAgent = request.getHeader("User-Agent");
                        System.out.println("userAgent --> "+userAgent);
                        String userSeparator="/"; // default
                        if (userAgent.indexOf("Windows")!=-1)
                        System.out.println("test --> "+"\\");
                        userSeparator="\\";
                        if (userAgent.indexOf("Linux")!=-1)
                        userSeparator="/";
                        System.out.println("userSeparator "+userSeparator);
                        System.out.println("fileName before inserting userSeparators "+fileName);
                        fileName = fileName.substring(fileName.lastIndexOf(userSeparator)+1,fileName.length()-1);
                        System.out.println("fileName after userSeparators "+fileName);
                        if(fileName.startsWith( "\""))
                        fileName = fileName.substring( 1);
              name = name.substring(1,name.length()-1);
              System.out.println("name 2 --> "+name);
              System.out.println("final file name "+fileName);
              if (name.equals("file"))
                   if (buffer!=null)
                   buffer.close();
                   lastFileName = fileName;
                   buffer = new java.io.FileOutputStream("/Documents and Settings/sunil/Desktop/images/"+fileName);
         else if(s.startsWith("Content-Type") && state==1)
                             System.out.println("-- 2 --");
              state = 2;
              contentType2 = s.substring(s.indexOf(":")+2,s.length()-2);
              System.out.println("contentType2 --> "+contentType2);
         else if(s.equals("\r\n") && state != 3)
                   System.out.println("-- 3 --");
              state = 3;
         else
              System.out.println("-- 4 --");     
              if (name.equals("file"))
              System.out.println("Final x :: "+x);     
              buffer.write(b,0,x);
    }     // while closing
    sis.close();
    buffer.close();
    }catch(java.io.IOException e)
    err = e.toString();
    boolean ok = err.equals("");
    if(!ok)
    out.println(err);
    else
    %>
              <SCRIPT language="javascript">
              history.back(1);
              alert('Uploaded <%=lastFileName%>');
              window.location.reload(false);
              </SCRIPT>
    <%
         out.println("done");
    %>
    </BODY>
    </HTML>
    I think it will solve ur problem..

  • Store pdf in blob

    can any one tell me how to store a pdf file in the blob.
    I m using forms 10g rel2 and oracle xe 10g.

    Hello Master,
    <p>Have a look at this one</p>
    Francois

  • How to Store bollean selection values and retrieve them in runtime?

    I have an array of bolleans representing a channel of a device. Now , when the user turns on the channel the selected channel array are supposed to be stored. Now when the user selects device 2 (using a ring function) the list refreshes t5he channel names and resets the bollean array to their default values and the new selection values are to be stored. Now if the user wants, he should revert back to device 1 and can review what all channels he had selected for Device 1. How can this functionality be achieved?
    Labview Learner
    Attachments:
    1.PNG ‏14 KB
    2.PNG ‏14 KB

    You need to store the boolean array somewhere.  I would likely just use a shift register
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Any good way to store pdf files in oracle 10g?

    have, i have many pdf files, i want to store in database. Any good way to do that in 10g? Or, I have to go to 11?
    thanks,
    t.k.

    mbobak wrote:
    Justin Cave wrote:
    user10217806 wrote:
    Can I store pdf in blob, and still search words in the pdfs?Probably not, no. If you want to search the data inside Oracle, you'll want to look at Oracle Multimedia.I think the correct answer is "not efficiently". :-)Well, there is nothing that prevents you from building Oracle Multimedia yourself and getting similar levels of efficiency. Other than a desire not to invest dozens of man-years replicating delivered functionality, of course.

  • How to insert and retrieve zip files in to blob column in oracle database?

    Hi All,
    I have a requirement where i need to insert zip files to BLOB and retrieve them.
    Please suggest me any good example or redirect me to them.

    You already have a post on this subject here: read and write compressed data from blob in ADF
    Please do not post duplicate questions.

  • How to store and retrieve a PDF form to SQL Server from LiveCycle?

    My intention is to save a complete PDF form into a database and then later on retrieve this form from DB.
    To do this, SQL Server has got two datatypes, image or Varbinary(max). I am able to store a PDF using "Execute SQL Statement"(I have written an Insert statement). Some value is being written into DB as well.
    But when I try to retrieve this record using "Query Single Row"(I store the result to a doc variable), the retrieved PDF is of an unknown type and cannot be opened by Adobe Reader.
    I am not sure if my approach is correct. Is it possible to store/retrieve a PDF form to/from a DB through LiveCycle?
    If yes, please give me some guidance.

    hi
    am not sure
    but u can use the same concept as storing image in db and retrieve..
    create a blob column
    parse that pdf and store into that column.
    again u retrieve the content and via file io make the same name with pdf extension..

  • Acrobat 5 - Placing PDF into inDesign and Output to Colour Separations are Wrong

    Acrobat 5 - Placing PDF into inDesign and Output to Colour Separations are Wrong
    I have a 2 Page PDF file from my client which I have to have setup 2UP on 450x320 for Metal Plates for the Press.
    I setup my page size in inDesign and Placed each page from the PDF file into the inDesign Document.
    Because I need 4 Metal plates (CMYK) I had to check the Colour Seperations for the file by outputting it to a Postscript file with CMYK SEPS and then using Adobe Distiller to turn it into a PDF file for me to view the Seperations.
    As I've shown in the screen shot below. The CYAN plate has boxes all around the images in the PDF file which will come out on a Metal Plate.
    Compared to the Colour version of the Client's PDF they supplied me, there is no boxes around the images.
    I know this is a error with dropping a PDF file into inDesign, outputting to a PS file and then Distilling it to the SEPS. I've had the same problem when I've opened a PDF file that has been distilled in Illustrator and the Artwork is sliced into pieces and uneditable.
    Has anyone else found this problem and if so is there a workaround?
    I'm using Adobe inDesign CS and Adobe Acrobat Professional Version 5.

    Im facing a similar kind of problem. I want to store and retrieve Office files, PDF and Jpegs into/from the database to view them on web in disconnected mode. Please reply as I cant find any help/documentation regarding saving BLOB data into files. I was able to store file data into BLOB, using DBMS_LOB package.
    Shahzad

  • How to Create a Rich Dynamic Input and Output PDF to insert and get data into, from Database (MSSQL)

    HI ,
    I want to use Adobe LiveCycle Designer and Adobe LiveCycle Workbench features to create a Dynamic PDF form which can allow me to store data into database(MSSQL Server) and Can also provide me the Output PDF form with all the information which has been been filled in by the User in input form. Both Input and Output forms must be Dynamic. I am stuck in this process and Need Experts Advice on the Complete optimal process flow of the Adobe.
    Regards
    Ritesh Grover

    HI
    Go to the lay out of your screen and doublr click on the table control fields, you can get the Properties/Attribute of the screen or table control Fields
    Assing a Group GRP1 for all the fields i n the table control.
    in PBO
    if ok_code = 'INPUT'.
    LOOP AT SCREEN.
    IF screen-grp1 = 'GRP1'.
    screen-input = 1.
    modify screen.
    endif.
    ENDLOOP.
    elseif ok_code = 'OUTPUT'.
    LOOP AT SCREEN.
    if screen-grp1 = 'GRP1'.
    screen-input = 0.
    modify screen.
    endif.
    endloop.
    endif.
    Regards
    Ramchander Rao.K
    Edited by: Ramchander Krishnamraju on Aug 8, 2009 5:27 AM

  • How to save and retrieve an excel file as an object into lob column?

    Hi ,
    I need to save and retrieve the whole excel file with 3 or more sheets as an object into the lob column of table.
    For example:
    t_docments
    (doc_id number,
    excel_data clob
    All excel files need to be saved to excel_data column.
    What should I do?
    Thanks

    Did you check the asktom thread posted by Jens?
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P1
    1_QUESTION_ID:232814159006
    There's example of varies file types.Yes, I did try some examples.
    Those work for .doc/.pdf/.jpg files, BUT NOT for excel file.
    The following error happened when retrieving excel file(retrieving .doc/.pdf are OK)
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 18
    ORA-06512: at "SYS.UTL_FILE", line 375
    ORA-06512: at "SYS.UTL_FILE", line 990

  • Storing an array of checkbox booleans into preferences and retrieving them

    Just wondering how to go about storing an array of JCheckBoxes into a preference and retrieving it. There's 32 checkboxes so if they select, say, 6 of these randomly it should store it in a preference file and retrieve it when the application is loaded so that the same 6 checkboxes remain selected. I'm currently getting a stack overflow error, though.
    import java.util.prefs.*;
    public class Prefs {
         Preferences p;
         GUI g = new GUI();
         public Prefs() {
              p = Preferences.userNodeForPackage(getClass());
              g = new GUI();
         public void storePrefs() {
              for (int i = 0; i < g.symptoms.length; i++) {
                   p.putBoolean("symptoms", g.symptoms.isSelected());
         public void retrievePrefs() {
              for (int t = 0; t < g.symptoms.length; t++) {
                   p.getBoolean("symptoms", g.symptoms[t].isSelected());
    symptoms is the array of checkboxes in the GUI class. Not sure where I am going wrong here. I can do it with strings from textfields etc but this is proving to be an annoyance. :(
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Actually, I have a better example, see below
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.util.prefs.*;
    public class PreferencesTest {
        private Preferences prefs;
        public static final String PREF_OPTION = "SELECTED_MENU_ITEM";
        public void createGui() {
            prefs = Preferences.userNodeForPackage(this.getClass());
            JMenuItem exitAndCloseMenuItem = new JMenuItem("Exit");
            exitAndCloseMenuItem.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e) {
                    System.exit(0);
            JMenu fileMenu = new JMenu("File");
            fileMenu.add(exitAndCloseMenuItem);
            JCheckBoxMenuItem[] preferenceItems = {
                new JCheckBoxMenuItem("pref 1"),
                new JCheckBoxMenuItem("pref 2"),
                new JCheckBoxMenuItem("pref 3"),
                new JCheckBoxMenuItem("pref 4")};
            int selectedMenuItem = prefs.getInt(PREF_OPTION, 0);
            preferenceItems[selectedMenuItem].setSelected(true);
            ButtonGroup preferencesGroup = new ButtonGroup();
            JMenu preferenceMenu = new JMenu("Preferences");
            for(int i = 0;i<preferenceItems.length;i++){
                preferenceItems.setActionCommand(Integer.toString(i));
    preferenceItems[i].addActionListener(new menuItemActionListener());
    preferencesGroup.add(preferenceItems[i]);
    preferenceMenu.add(preferenceItems[i]);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(preferenceMenu);
    JFrame f = new JFrame("Prefernce Test");
    f.setJMenuBar(menuBar);
    f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    public static void main(String[] args){
    new PreferencesTest().createGui();
    class menuItemActionListener implements ActionListener{
    public void actionPerformed(ActionEvent e) {
    JCheckBoxMenuItem jcbm = (JCheckBoxMenuItem)e.getSource();
    prefs.put(PREF_OPTION, jcbm.getActionCommand());

  • I am trying to drag and drop one page of a .pdf into another .pdf in Acrobat Reader.  I used to be able to drag and drop from one .pdf to another.

    I am trying to drag and drop one page of a .pdf into another .pdf in Acrobat Reader.  I used to be able to drag and drop from one .pdf to another.

    If you could drag and drop pages before, it wasn't in Reader. You no doubt had Adobe Acrobat (Pro or Standard) which shouldn't be confused with Adobe Acrobat Reader. They recently added Acrobat to the name of Adobe Reader so the confusion about which product you had and/or have is understandable.

  • Im trying to convert a PDF into an excel document and I keep getting an error message that reads "An error has occurred while trying to access the service". WHat am I doing wrong?

    Im trying to convert a PDF into an excel document and I keep getting an error message that reads "An error has occurred while trying to access the service". WHat am I doing wrong?

    it seems my subscription had expired so I signed up again.. It was still having trouble so I repeated the sign up process again.. Then it worked perfectly.. Unfortunately, I think I just subscribed twice and need to cancel one of them. Ugh. Such a pain when I'm trying to get this project completed. I'll be canceling at least one of the subscriptions in the morning. Adobe is not my favorite company right now. None of this was intuitive. And trying to get help was an absolute waste of an hour.
    Regards,
    Nathaniel
    [removed by moderator]

Maybe you are looking for

  • Remote for ipad, cant find songs, but my iphone can, on the same network

    hi all have a very odd problem, and apple cant seem to help me, i´m using the app called remote, to control my itunes music, from both my iphones, ipod touch and the ipad, they all connect to the same itunes music library and i can control them just

  • SRM 5.0 Installation Documents

    Hi I am planning to install SRM 5.0 Can anybody send me Installation and configuration documents as well as cookbook for the same. I will be really very thankful. My email id is [email protected] Thanks Vitthal prabhu

  • I can't select a portion of a scanned page

    I often have documents scanned into PDF format at two different copy shops. Sometimes I want to use the Acrobat 8 or Adobe Reader 7 selection tool to select a portion of a scanned page and then edit that selection in Photoshop. When I open scan from

  • How to include a function in a responsibility

    I have many rsponsibilities using the same menu. I want to create a new one that has access to the same menu + 1 additional function. Is it possible without creating a new menu?

  • How to use powershell in sharepoint 2007

    How to use powershell in sharepoint 2007