How to load a PDF blob?

Hi, could some one help me with the steps to loading a DPF file into a table. In this table I have a column which is a BLOB datatype where I would like to store these PDF's.
Any help would be greatly appriciated!
Thanks for your time.

CREATE OR REPLACE PROCEDURE load_pdf_blob IS
dest_loc BLOB;
src_loc BFILE;
Amount INTEGER;
new_dir string(1000) := 'test_dir';
new_file string(1000) := 'test_pdf.pdf';
BEGIN
src_loc := BFileName(new_dir,new_file);
Amount := dbms_lob.getlength(src_loc);
insert into test_pdf (sno,pdf_file)
values (seq_val,empty_blob());
DBMS_LOB.OPEN(src_loc, DBMS_LOB.LOB_READONLY);
DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
DBMS_LOB.LOADFROMFILE(dest_loc, src_loc, Amount);
DBMS_LOB.CLOSE(dest_loc);
DBMS_LOB.CLOSE(src_loc);
COMMIT;
END load_pdf_blob;
/

Similar Messages

  • How to load a PDF from a stream

    Hi,
    I'm looking at how to load a PDF file from a stream in .NET, e.g. something like a MemoryStream or FileStream. All of the methods I've seen so far only allow the PDF to be loaded from a file which we don't want to do because of security issues. I know I can do this with a third party tool, but is this possible without using any additional tools?
    Cheers,
    Dave Harrington.

    > I have a feeling that removing the save button will not be possible.
    You cannot remove the save button, no, but you can replace its execute method with something that, say, pops up a warning to the user instead.
    > Is there any way to just load the file using a URL?
    The ActiveX control definitely loads a URL. See the "src" property of the ActiveX control. If you download the SDK, the ActiveView sample actually loads a PDF from a URL by default.

  • How to load images from BLOB to javascript?

    hi, Guys:
    I need to load thumbnail images from BLOB to multiple markers' infowindow in Google map . I have implemented Google map in APEX. I load the data suchas text for every marker's infowindow from Oracle database table with PL/JSON, and infowindow works fine. Could anyone give me a suggestion or example so I know how to load images to javascript?
    Thanks a lot.
    Database: Oracle 11g R2
    APEX: APEX 4.1
    Thanks.
    Sam

    lxiscas wrote:
    hi, VC:
    Thanks for your kind reply. I need to render these images out of APEX session, actually in javascript that is related to Google map markers' infowindow.
    I checked the documents of APEX_UTIL.GET_BLOB_FILE_SRC, but my impression is I need to use it in APEX instead of javascript if my understanding is correct. I already implemented a procedure with PL/SQL to load images from a BLOB column in Oracle database. But the problem is, how can I pass it to javascript code out of APEX to javascript (I could pass text or number from APEX to javascript with PL/JSON though,But I assume that still google map will be within a valid apex session? if so you should be able to use the above api.
    Basically what this api does is generates a kind of url to each blob in the database, not sure how google api's deal with this though. Why don't you give it a try?
    The other option is to make your pl/sql procedure public and then you can generate the json to include the images urls such as:
         "employees" : [{
                   "firstName" : "John",
                   "lastName" : "Doe",
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Anna",
                   "lastName" : "Smith"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
                   "firstName" : "Peter",
                   "lastName" : "Jones"
                   "imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
    }And then you can use this new attribute to populate the images in javascript using standard img tag
    See this tutorial http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm
    I did not find any method in PL/JSON to pass image object)? So far I only found example to load images from local files to javascript.Hmm..I don't think you should load image objects.
    Vikram

  • How to load a PDF from page 1 in IE

    I am currenty working on a fllex based web application that needs to load multiple PDF documents. The pdfs are loaded and displayed properly but after the user scrolls couple of pages/ lines and switches to a new document, IE saves the last visit cursor position of the pdf document. On user revisit to the first PDF the IE loads it from the last cursor position.
    I need to reload the PDF document from Page 1 everytime the user selects to load a pdf document.
    Is there any setting in the Adobe Acrobat Page display settings or in the IE that would help me accomplish my task.
    Please respond ASAP.
    NOTE: The pdf is loaded inside  an IFRAME.
    Thanks,
    -Karun

    > I have a feeling that removing the save button will not be possible.
    You cannot remove the save button, no, but you can replace its execute method with something that, say, pops up a warning to the user instead.
    > Is there any way to just load the file using a URL?
    The ActiveX control definitely loads a URL. See the "src" property of the ActiveX control. If you download the SDK, the ActiveView sample actually loads a PDF from a URL by default.

  • PSE 9 how to load only pdf files ina catalogue?

    I chose "file type:" PDF in the menu "Load Photos, Videos from folder and files" but I am not able to avoid that also JPEG files are loaded in the catalogue.
    Moreover, the program freezes many times.
    Am I doing something wrong or is not possible to load only a type of file?
    My purpose is to get a catalogue with only a copy of all my PDF I have split in many directories.
    Thank you for help

    It would probably be easier to separate your PDFs from your jpegs. One suggestion is to do a system search for all PDF’s and then import them all from a single folder. It really depends how important your folder structure is.
    1. Create a new folder My PDFs
    2. Launch Windows Explorer and click the search button on the top ribbon next to folders
    3. Choose All Files & Folders
    4. In the box below All or part of File name type: *.PDF
    5. Click the Search button and wait for the search to finish
    6. Ignore results in /WINDOWS or /Program Files folders
    7. Select all other PDF’s in Documents & settings locations
    8. When all you PDF’s are highlighted click the top menu Edit >> Move to Folder
    9. Choose you new folder My PDF’s and click Move.
    You could split the task by selecting batches to move. When you have moved them all to My PDF’s import into Organizer from My PDF's
     

  • How to load a pdf/xls/swf files in to a adf:popup

    hi
    my requirement is to open a pdf/xls/swf in a popup. howcan i get a poup with pdf/xls/swf files . presently i am using a servlet.I set the content type in the servlet as application/pdf and so on..
    I am getting data as byte stream from the data base.know how to give this bytestream/response object of the servlet to the panel window.
    In a popup i placed panel window.the struture is:
    <af:popup>
    <af:panelwindow>
    </af:panelwindow>
    </af:popup>
    thanks in advance
    Srikanth.V
    Message was edited by:
    user631950

    Hi,
    I have a similar requirement where I need to show the preview of a document in a popup.
    I have a button and I added "af:fileDownloadActionListener" into the button, then I wrote the following code in my bean for the downloadactionlistener:
    public void showPreviewDownloadListener(FacesContext facesContext,
    java.io.OutputStream outputStream) throws IOException{
    DCIteratorBinding agr = getBindingsForDCB().findIteratorBinding("xyz");
    Row row = ag.getRowSetIterator().getCurrentRow();
    String fileName = (String)row.getAttribute("FileName");
    String fileType = (String)row.getAttribute("FileType");
    BlobDomain file = (BlobDomain)row.getAttribute("FileData");
    try {
    InputStream inputStream = file.getBinaryStream();
    byte[] buf = new byte[1024];
    int count;
    while ((count = inputStream.read(buf)) >= 0) {
    outputStream.write(buf, 0, count);
    inputStream.close();
    outputStream.flush();
    outputStream.close();
    file.closeInputStream();
    docPreviewInlineFrame.setSource(fileName);
    //ADFUtils.setEL("#{pageFlowScope.docSource}", "../"+fileName);
    ADFUtils.invokePopup(docPreviewPopup,true);
    catch(IOException ioex) {
    ioex.printStackTrace();
    when I'm clicking my button, all it does is open a popup to view/download the while.
    My own popup (with a dialog and an internalFram in it) does not get invoked at all.
    Also the file that I'm referring is from DB, can anyone also suggest me how to set the source for the inline frame if the file is from DB?
    Thanks in advance,
    Swapna

  • How to load a pdf inside flash

    I need open a pdf inside flash how I do this?

    armandix,
    > I need open a pdf inside flash how I do this?
    You can't, really. Flash Player doesn't support Acrobat.
    Specifically,
    you can't open a PDF in Flash and have it act like a PDF
    (scrollable,
    searchable, etc.). But you can certainly convert your PDF (or
    a page from
    your PDF) to an image format and import that.
    David Stiller
    Co-author, Foundation Flash CS3 for Designers
    http://tinyurl.com/2k29mj
    "Luck is the residue of good design."

  • URGENT: Problems Loading files with SQL Loader into a BLOB column

    Hi friends,
    I read a lot about how to load files into blob columns, but I found errors that I can't solve.
    I've read several notes in these forums, ine of them:
    sql loader: loading external file into blob
    and tried the solutions but without good results.
    Here are some of my tests:
    With this .ctl:
    LOAD DATA
    INFILE *
    INTO TABLE mytable
    REPLACE
    FIELDS TERMINATED BY ','
    number1 INTEGER EXTERNAL,
    cad1 CHAR(250),
    image1 LOBFILE(cad1) TERMINATED BY EOF
    BEGINDATA
    1153,/opt/oracle/appl/myapp/1.0.0/img/1153.JPG,
    the error when I execute sqlldr is:
    SQL*Loader-350: Syntax error at line 9.
    Expecting "," or ")", found "LOBFILE".
    image1 LOBFILE(cad1) TERMINATED BY EOF
    ^
    What problem exists with LOBFILE ??
    (mytable of course has number1 as a NUMBER, cad1 as VARCHAR2(250) and image1 as BLOB
    I tried too with :
    LOAD DATA
    INFILE sample.dat
    INTO TABLE mytable
    FIELDS TERMINATED BY ','
    (cad1 CHAR(3),
    cad2 FILLER CHAR(30),
    image1 BFILE(CONSTANT "/opt/oracle/appl/myapp/1.0.0/img/", cad2))
    sample.dat is:
    1153,1153.JPEG,
    and error is:
    SQL*Loader-350: Syntax error at line 6.
    Expecting "," or ")", found "FILLER".
    cad2 FILLER CHAR(30),
    ^
    I tried too with a procedure, but without results...
    Any idea about this error messages?
    Thanks a lot.
    Jose L.

    > So you think that if one person put an "urgent" in the subject is screwing the problems of
    other people?
    Absolutely. As you are telling them "My posting is more important than yours and deserve faster attention and resolution than yours!".
    So what could a typical response be? Someone telling you that his posting is more important by using the phrase "VERY URGENT!". And the next poster may decide that, no, his problem is evern more import - and use "EXTREMELY URGENT!!" as the subject. And the next one then raises the stakes by claiming his problem is "CODE RED! CRITICAL. DEFCON 4. URGENT!!!!".
    Stupid, isn't it? As stupid as your instance that there is nothing wrong with your pitiful clamoring for attention to your problem by saying it is urgent.
    What does the RFC's say about a meaningful title/subject in a public forum? I trust that you know what a RFC is? After all, you claim to have used public forums on the Internet for some years now..
    The RFC on "public forums" is called The Usenet Article Format. This is what it has to say about the SUBJECT of a public posting:
    =
    The "Subject" line (formerly "Title") tells what the message is about. It should be suggestive enough of the contents of the message to enable a reader to make a decision whether to read the message based on the subject alone. If the message is submitted in response to another message (e.g., is a follow-up) the default subject should begin with the four characters "Re: ", and the "References" line is required. For follow-ups, the use of the "Summary" line is encouraged.
    =
    ([url http://www.cs.tut.fi/~jkorpela/rfc/1036.html]RFC 1036, the Usenet article format)
    Or how about [url http://www.cs.tut.fi/~jkorpela/usenet/dont.html]The seven don'ts of Usenet?
    Point 7 of the Don'ts:
    Don't try to catch attention by typing something foolish like "PLEASE HELP ME!!!! URGENT!!! I NEED YOUR HELP!!!" into the Subject line. Instead, type something informative (using normal mixed case!) that describes the subject matter.
    Please tell me that you are not too thick to understand the basic principles of netiquette, or to argue with the RFCs that governs the very fabric of the Internet.
    As for when I have an "urgent" problem? In my "real" work? I take it up with Oracle Support on Metalink by filing an iTAR/SR. As any non-idiot should do with a real-life Oracle crisis problem.
    I do not barge into a public forum like you do, jump up and down, and demand quick attention by claiming that my problem is more important and more urgent and more deserving of attention that other people's problem in the very same forum.

  • To load a pdf in a Panel

    Hi,
    How to load a pdf in a panel.
    I tried the code:-
    var u:URLRequest = new
    URLRequest("../pdf/Registration.pdf");
    navigateToURL(u,"_blank");
    This will open the pdf in a new window. I need to get the pdf
    file open in a panel .

    There's no way to load PDF -inside- your SWF content. You can
    do it the other way around (have a PDF that hosts a SWF). But Flash
    Player doesn't read PDF. So you have to do this with a new window
    or an iframe or something similar..

  • How to insert a pdf or jpeg image into a blob column of a table

    How to insert a pdf or jpeg image into a blob column of a table

    Hi,
    Try This
    Loading an image into a BLOB column and displaying it via OAS
    The steps are as follows:
    Step 1.
    Create a table to store the blobs:
    create table blobs
    ( id varchar2(255),
    blob_col blob
    Step 2.
    Create a logical directory in the database to the physical file system:
    create or replace directory MY_FILES as 'c:\images';
    Step 3.
    Create a procedure to load the blobs from the file system using the logical
    directory. The gif "aria.gif" must exist in c:\images.
    create or replace procedure insert_img as
    f_lob bfile;
    b_lob blob;
    begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return blob_col into b_lob;
    f_lob := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);
    commit;
    end;
    Step 4.
    Create a procedure that is called via Oracle Application Server to display the
    image.
    create or replace procedure get_img as
    vblob blob;
    buffer raw(32000);
    buffer_size integer := 32000;
    offset integer := 1;
    length number;
    begin
    owa_util.mime_header('image/gif');
    select blob_col into vblob from blobs where id = 'MyGif';
    length := dbms_lob.getlength(vblob);
    while offset < length loop
    dbms_lob.read(vblob, buffer_size, offset, buffer);
    htp.prn(utl_raw.cast_to_varchar2(buffer));
    offset := offset + buffer_size;
    end loop;
    exception
    when others then
    htp.p(sqlerrm);
    end;
    Step 5.
    Use the PL/SQL cartridge to call the get_img procedure
    OR
    Create that procedure as a function and invoke it within your PL/SQL code to
    place the images appropriately on your HTML page via the PL/SQL toolkit.
    from a html form
    1. Create an HTML form where the image field will be <input type="file">. You also
    need the file MIME type .
    2. Create a procedure receiving the form parameters. The file field will be a Varchar2
    parameter, because you receive the image path not the image itself.
    3. Insert the image file into table using "Create directory NAME as IMAGE_PATH" and
    then use "Insert into TABLE (consecutive, BLOB_OBJECT, MIME_OBJECT) values (sequence.nextval,
    EMPTY_BLOB(), 'GIF' or 'JPEG') returning BLOB_OBJECT, consecutive into variable_blob,
    variable_consecutive.
    4. Load the file into table using:
    dbms_lob.loadfromfile(variable_blob, variable_file_name, dbms_lob.getlength(variable_file_name));
    dbms_lob.fileclose(variable_file_name);
    commit.
    Regards,
    Simma........

  • How to show in a report a pdf blob from database

    Hi all
    We are working on report 6i and report 10. We have a report wich needs to show a blob field from database that storages a pdf (type application/pdf). OLE2 is deprecated. The pdf blob field must be displayed in a preview and must be printed. In local, it works. When it works on a browser, the pdf blob field is missing. If we load the field into a pdf file, the field is not visible in the browser.
    Do not get it to work. How I can implement? Could you give us any example for this?

    In local, it works. What do you mean by that exactly? You see the pdf in Reports Builder?
    If you just want to show the pdf in a browser (not embedded in a report) it is easy to use mod_plsql. You can have a simple db procedure like this to show any kind of blob:
    procedure show_webdoc(io_blob    in out nocopy blob
                         ,i_mimetype in varchar2
                         ,i_filename in varchar2)
    is
    begin
       if dbms_lob.getlength(io_blob) >0 then
          owa_util.mime_header(nvl(i_mimetype,'application/octet'),false);
          htp.p('Content-length: ' || dbms_lob.getlength(io_blob));
          htp.p('Content-Disposition:  inline; filename="'||i_filename|| '"');
          owa_util.http_header_close;
          wpg_docload.download_file(io_blob);
       end if;
    end show_webdoc;

  • How to index a gzipped pdf blob

    Hi,
    I already have a TAR logged on this but if anyone knows how to do this, I would greatly appreciate any tips.
    I have our PDF documents stored in BLOB's in our DB but they are stored in gzipped format for significant space savings. I have developed two oracle functions; "gzip" and "gunzip", which are wrappers to java classes loaded into the DB, that can do the gzip compression and uncompression on the fly. These functions
    accept BLOB's and return BLOB's. I use these functions to send the documents to client browsers, etc.
    Now, I want to index these PDF documents but have hit problems.
    Eg, suppose the table structure is; STREAM(STREAM_ID NUMBER, PDF_GZIPPED BLOB). I need to build an Oracle Text index on
    STREAM(unzip(PDF_GZIPPED)). Where the unzip function accepts a BLOB and returns a BLOB (the real PDF document).
    My original approach was to use the multicolumn datastore because context indexes using these datastores could be based on functions of the table columns rather than just table columns. Oracle support informed me that multicolumn datastores will only work for VARCHAR2 types (not BLOB's) so I can't use that.
    If anyone has experience in indexing table/column functions for BLOB's, I would be interested to hear how to go about it. Please remember our PDF BLOB's are gzipped, not just PDF documents dumped into BLOB's.
    Harris.

    Sorry, the "unzip" function should read "gunzip" in the previous post.
    Anyway, for those interested, I have found a temporary workaround but boy is it cludgy;
    1. Had to setup a USER_FILTER
    2. Wrote a shell script wrapper to ctxhx
    3. But ctxhx on 8.1.7.2 always failed (unsure at this stage)
    4. So, it calls ctxhx under a previous version of Oracle;
    Here is the code;
    exec ctx_ddl.drop_preference('unzip_filter');
    exec ctx_ddl.create_preference('unzip_filter','USER_FILTER');
    exec ctx_ddl.set_attribute('unzip_filter', 'COMMAND', 'unzip_inso');
    exec ctx_ddl.drop_preference('pdf_lexer');
    exec ctx_ddl.create_preference('pdf_lexer', 'BASIC_LEXER');
    exec ctx_ddl.set_attribute('pdf_lexer', 'printjoins', '_-');
    drop index cas_stream_blob_ctx_i;
    create index cas_stream_blob_ctx_i
    on cas.stream_blob(pdf_gzipped)
    indextype is ctxsys.context
    parameters('filter UNZIP_FILTER lexer PDF_LEXER');
    exec ctx_ddl.sync_index('cas_stream_blob_ctx_i');
    Here is the source of unzip_inso;
    #!/bin/ksh
    test $# -lt 2 && return
    TMP_DIR=/tmp
    TMP_FILE=${TMP_DIR}/ora_gunzip_$$
    /usr/bin/gunzip -cf $1 > ${TMP_FILE} &&
    OUTFILE=$2
    shift 2
    #$ORACLE_HOME/ctx/bin/ctxhx ${TMP_FILE} ${OUTFILE} $*
    # 8.1.6 workaround
    export ORACLE_HOME=/product/oracle/8.1.6
    export LD_LIBRARY_PATH=$ORACLE_HOME/ctx/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH_64=$ORACLE_HOME/ctx/lib64:$LD_LIBRARY_PATH_64
    ${ORACLE_HOME}/ctx/bin/ctxhx ${TMP_FILE} ${OUTFILE} $*
    rm -f ${TMP_FILE}
    It works - but very ugly.
    Still seeking a better solution - since I have the gzip utilities
    already loaded in the DB.

  • How to load PDF files into oracle database and display them in APEX

    Hi All,
    We have a requirement for loading the Loading PDF files (lots of PDf files) to the oracle database and then display the PDF files in the Oracel APEX report.
    So that User can view the PDF files. Our current APEX verison is 3.2..
    Please let me know how to implement it and where to find the sample application!
    Thanks in advanced!
    Jane

    Thanks Tony for your quick response!
    We need to load a lot of PDfs (history + current).
    I have a questions about the SQL loader. I am trying to insert a pdf file into a table by following the oracle loading sample:
    http://download.oracle.com/docs/cd/B10501_01/text.920/a96518/aload.htm
    Example Data File: loader2.dat
    This file contains the data to be loaded into each row of the table, articles_formatted.
    Each line contains a comma separated list of the fields to be loaded in articles_formatted. The last field of every line names the file to be loaded in to the text column:
    Ben Kanobi, plaintext,Kawasaki news article,../sample_docs/kawasaki.txt,
    But i don't know to where should I put my pdf file on the server.
    for example:
    ,../sample_docs/kawasaki.txt,
    Where is the file 'kawasaki.txt'??
    I try my local path, it didn't work. like c:\temp.
    then I loaded teh PDf file into our server(/findev20/olmtest/orafin/11.5.7/olmtestcomn/temp) , and In my data file. I put the path
    1, pdf_emp1,../findev20/olmtest/orafin/11.5.7/olmtestcomn/temp
    but I got the error: the system can not find the file specified.
    Where should I put the PDf files on the server and how to specify the path in the data file?
    Thanks!
    Jane

  • How to Upload a PDF file into BLOB column in a table using Forms 9i

    Can anyone tell me how to upload a PDF file from client system using File dialog window and store its content in BLOB column in a table. The file to be uploaded will be in client side.

    Hi,
    please, search a bit on the forum before do a question:
    Just searching by "upload blob pdf" ...
    How to batch upload PDF files into database BLOB
    Regards,
    Jose.

  • How to Upload a PDF file into BLOB column in a table using Forms 6i

    Can anyone tell me how to upload a PDF file from client and store its content in BLOB column in a table. The file will be genered using reports and win be stored in db.The file to be uploaded will be in client side.
    Thank´s.

    If you are using version 9 or 10 use webutil.... Look in webutil.pll.
    Use either one these two fuctions...
    FUNCTION Client_To_DB( clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;
      FUNCTION Client_To_DB_With_Progress
                         (   clientFile       in VARCHAR2,
                             tableName        in VARCHAR2,
                             columnName       in VARCHAR2,
                             whereClause      in VARCHAR2,
                             progressTitle    in VARCHAR2,
                             progressSubTitle in VARCHAR2,
                             asynchronous     in BOOLEAN default FALSE,
                             callbackTrigger  in VARCHAR2 default NULL) return BOOLEAN;

Maybe you are looking for