BLOBS (pdf, doc, bmp, jpg, gif, ppt, xls) to OS SERVER FILE

Hi,
I am using Oracle9i Enterprise Edition Release 9.2.0.6.0 on Unix (SUSE Linux and Solaris).
I have a table which holds a blob which was loaded from a file. This file could be any of the above formats.
I need to create a function which will create a file on the OS from the BLOB in the database.
I created a function which did this using DBMS_LOB to read from the BLOB in chunks and UTL_FILE.PUT_RAW to write to the file.
This works fine for most of the document types apart from BITMAPS.
I have 2 problems:
1. There are extra chars/carriage returns added to the end of the file for all the documents. This seems to cause a problem with opening some of the file types.
2. If the file is a bitmap or contains a bitmap, the file stops at the start of the bitmap so the file is therefore not created.
If anyone can help me with this, I would be very grateful
Thanks,
Julie

I want to retrieve stored pdf,docetc from database, but i m nt able to retrieve it.
Can any1 help me.
1. C:\Documents and Settings\JAVA SAP>set oracle_sid=prd1
C:\Documents and Settings\JAVA SAP>sqlplus
Enter user-name: / as sysdba
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
2. create table demo
(id int primary key, theBlob blob)
Table created.
3. SQL> create or replace directory my_files as 'E:\'
Directory created.
4. declare
l_blob blob;
l_bfile bfile;
begin
insert into demo values(1,empty_blob())
returning theBlob into l_blob;
l_bfile:=bfilename('MY_FILES','n1.pdf');
dbms_lob.fileopen(l_bfile);
dbms_lob.loadfromfile(l_blob,l_bfile,dbms_lob.getlength(l_bfile));
dbms_lob.fileclose(l_bfile);
end;
PL/SQL procedure successfully completed.
5. CREATE OR REPLACE DIRECTORY my_out_files AS 'E:\';
CREATE OR REPLACE PROCEDURE WriteBLOBToFILE (myid IN number) IS
v_blob BLOB;
blob_length INTEGER;
out_file UTL_FILE.FILE_TYPE;
v_buffer RAW(32767);
chunk_size BINARY_INTEGER := 32767;
blob_position INTEGER := 1;
BEGIN
SELECT theblob INTO v_blob FROM demo WHERE id = myid;
blob_length:=DBMS_LOB.GETLENGTH(v_blob);
out_file := UTL_FILE.FOPEN ('MY_OUT_FILES', 'myid.pdf', 'wb',
chunk_size);
WHILE blob_position <= blob_length LOOP
IF blob_position + chunk_size - 1 > blob_length THEN
chunk_size := blob_length - blob_position + 1;
END IF;
DBMS_LOB.READ(v_blob, chunk_size, blob_position, v_buffer);
UTL_FILE.PUT_RAW(out_file, v_buffer, TRUE);
blob_position := blob_position + chunk_size;
END LOOP;
UTL_FILE.FCLOSE (out_file);
END;
6. SET serveroutput ON
EXEC WriteBLOBToFILE(1);
I tired this also.
declare
i1 blob;
i2 number;
amt number := 10000;
len number;
my_vr raw(10000);
l_output utl_file.file_type;
p_dir varchar2(30) default 'TEST_DIR';
p_file varchar2(30) default 'gs_test1.doc';
begin
-- get the blob locator
l_output := utl_file.fopen(p_dir, p_file, 'w', 32760);
for l_cur in (SELECT id,theBlob from demo where rownum = 1 order by id)
loop
len := DBMS_LOB.GETLENGTH(l_cur.theBlob);
i1 := l_cur.theBlob ;
dbms_output.put_line('Length of the Column : ' || to_char(len));
i2 := 1;
if len < 10000 then
DBMS_LOB.READ(i1,len,i2,my_vr);
utl_file.put(l_output, my_vr );
else
DBMS_LOB.READ(i1,amt,i2,my_vr);
utl_file.put(l_output, UTL_RAW.CAST_TO_VARCHAR2(my_vr) );
end if;
i2 := i2 + amt;
while (i2 < len) loop -- loop till entire data is fetched
dbms_output.put_line('i2 : ' || to_char(i2));
DBMS_LOB.READ(i1,amt,i2,my_vr);
utl_file.put(l_output, UTL_RAW.CAST_TO_VARCHAR2(my_vr) );
utl_file.fflush(l_output);
i2 := i2 + amt ;
end loop;
utl_file.fclose(l_output);
end loop;
end ;

Similar Messages

  • Download of PDF docs to Acrobat Pro, outside FF, results in Corrupt File message. Does not occur in IE or Chrome. Same result if Reader inside FF is attempted.

    Options set to have PDFs open in Adobe Acrobat (v 10 Pro) outside FF. File partially downloads and error message pops up indicating "There was an error opening this document. The file was damaged and could not be repaired.". Same result if Option is switched to having PDF open inside of FF. Not consistent - download will fail several times in a row, and then function properly. This issue began with V. 29 of FF, not seen previously. Adobe Acrobat is up-to-date, v. 10.1.10.
    Same website, same PDF, works fine in IE or Chrome.
    Running on Windows 7 Pro 64-bit SP1.

    Scanning occurs on the MS Exchange Server level, not my desktop, and occurs on imported files on ALL browsers, not only FF. Based on that, one wonders why the outcome would be different unless FF was treating the incoming files and/or the security scanning differently, leading to the failure of the downloads. As to the size, most of the files ARE a few MBs or more - that is the size of the PDFs I am interested in downloading.

  • Writing jpg/gif to rtf

    Hi all,
    I'm in the dark here. does anyone know how to save a jpg/gif with text to an rtf file???
    I don't know even where to start.
    Thanks
    ppr

    I'm not sure I'm following you.
    I checked
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/rtf/package-summary.html
    but it doesn't say anything.
    The truth is, it doesn't need to be in rtf, but with anything that can save both embeded pictures and text.

  • Store/Read JPG/GIF as file on Application server,cluster table/MIME Rpstory

    Hello All ,
    I was trying to build up a ImageStore proxy class to save JPG/GIF in the following ways .
    u2022     File format on Application server with GUID reference / Whenever I need I can read/ archive it with  ID#
    u2022     In cluster table  - Same concept
    u2022     In MIME repository
    I am thinking to use MIME APIs which are already available in SAP system .   Let me know if anyone of you has any good suggestions/tips/tricks to do it .
    BTW I have looked at Thomas Jung  blog as a starting point .
    /people/thomas.jung/blog/2007/09/05/abap-bitmap-image-processing-class
    Thanks.
    Khan

    Solved myself!!! Canu2019t believe.  .. Donu2019t ask how ..Lots of coding involves.

  • Display BLOB objects (doc, pdf, jpg, etc) in Browser

    Hello.
    I need help retrieving BLOBs from my DB and displaying them on a browser using Java (or JSP). The BLOB can contain any types of file form (such as pdf, doc, xls, jpeg,etc).
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by LP:
    Hello.
    I need help retrieving BLOBs from my DB and displaying them on a browser using Java (or JSP). The BLOB can contain any types of file form (such as pdf, doc, xls, jpeg,etc).
    <HR></BLOCKQUOTE>
    null

  • I can't open attachments on my iPad 2.  I have downloaded the 8.0.2 software update.  I can't open jpgs, PDFs, docs. or movie files now.

    I can't open attachments on my iPad 2t and I can't open jpgs, PDFs, docs. or movie files now.

    Obviously, you are talking about the mail app, so force close the mail app and reset your iPad. If that fails, reset all settings.
    In order to close apps, you have to drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it. 
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    When you reset all settings, you will not lose any data, but most of the device settings will have to be entered in the settings app again. Settings>General>Reset>Reset all Settings.

  • BLOB Column with PDF docs

    I already read a different ways to extract the PDF docs from oracle table and open it through forms. All of them with java classes, webutil integration and dbms_lob.
    But, if I need an other way to show it (select the column and open it) through the forms module, I can do it. Like Developer 6i, we can defined a OLE container field in forms and query the table and show the BLOB data.
    This are my scenerio:
    Oracle DB: EE 9.2.0.6.0
    Developer: 6i Rel 2 & 10g v. 10.1.2.0.2 (for test and eventually for migrate to production environment, with iAS R 9i)
    I already read if I need to use java, dbms_lob or webutil, I need to use it through iAS and in some cases I need to create a DAD.
    But, If have 10g in developer enviroment just for test and I don't want to use a iAS, do I have any other way to select a BLOB column (with a PDF files store in there) from a oracle table and be able to open it with acorbat reader.
    thank you a lot guys and sorry about all this message (related with the same) but I am no a guru oracle developer.
    AM

    Rechecked and was not logged on to user, checked the error view and got
    TEXT_INDEX_FRI 03/30/2001 1: AAAIt+AAFAAAAmDAAJ DRG-11207: user filter command exited with status 137
    searched some of the articles here on this error, checked that listener was running correctly for extproc, added to the listener the ENVS=LD_LIBRARY_PATH line
    added roles, resource, connect, ctxapp
    added to PATH and LD_LIBRARY_PATHs,
    but still get the above error
    does work though for simple text insert case, so seems to be related to documents in a blob field. Any other suggestions or queries that I can do to troubleshoot this? Could it be the way it is loaded?
    ================
    my sql loader control file
    LOAD DATA
    INFILE '/chem20/stuff/Load_docs2.dat'
    INTO TABLE imed.cmgendoc
    APPEND
    FIELDS TERMINATED BY ','
    (Doc_id char,
    author char,
    doc_name FILLER CHAR(255),
    act_doc LOBFILE(doc_name) TERMINATED BY EOF,
    mimetype char(128))
    ==================
    my dat file
    2,ted the frog,/chem20/stuff/snmp.pdf,application/pdf
    3,ted the dog,/chem20/stuff/config.pdf,application/pdf
    4,ted the cat,/chem20/stuff/oemcn.pdf,application/pdf
    5,ted the rat,/chem20/stuff/oemer.pdf,application/pdf
    6,ted the cow,/chem20/stuff/oemug.pdf,application/pdf
    7,ted the bug,/chem20/stuff/servlets.pdf,application/pdf
    8,ted the bird,/chem20/stuff/pg.pdf,application/pdf
    9,ted the sheep,/chem20/stuff/install.pdf,application/pdf
    null

  • Dan from iCloud Tech Support says that documents such as .pdf, .doc, .xls, etc. will NOT be stored on iCloud!  Huh???

    Called Tech Support because of 2 problems:
         1. Several of my documents have disappeared.  This includes some .pdf, .doc, and .xls files.
         2. Others are old copies of files that were updated, but all my changes were lost.
    Was informed by Dan in Tech Support that "documents will not be stored on iCloud."  He explained further that Word, Excel, PDF, etc. will not be stored on the Cloud--only music files, Pages, iPhoto, etc. will be.
    Is this true?  If so, this is stunningly bad.  And if it is true that iCloud isn't going to store documents, then why did it touch (i.e. lose, revert) them in the first place??  So all document storage will be on local or external drives now? 

    Dan is not entirely correct.
    If you install Goodreader this app WILL allow those documents to be stored on your icloud account within a specially created Goodreader container.
    Apple do allow third parties to use the conduit between desktop and iOS apps,however only a few third parties have implemented this todate..
    What icloud is NOT is unlimited remote storage,its more rather a syncing conduit.
    If you are looking at an idisk replacement do try Dropbox for that.
    Personally I employ BOTH methods in parallel at the moment as icloud remains very much a work in progress .
    I will probably transfer more to using the icloud route when the next desktop version of Pages is released and hopefully incorporates built in icloud sync functionality.The current requirement to utilize a web browser on your desktop to upload/download is a clutch !
    What does icloud do
    1 Sync photo images across iOS devices and with iPhoto or Aperture 3 on your Mac or with your Pictures folder in Win7
    2 Combines calendars between iOS and Mac Osx or  Outlook on Win7
    3 Combines Address book between ios and Mac OSx or Outlook on Win7
    4. Sync iWork- Documents in the cloud (Pages Numbers and Keynote) across iOS devices and upload/download to Mac or PC via icloud.com in web browser.
    5.Use find my iPhone/iPad/mac security functionality
    6.Remote backup of iOS devices.
    7. ITunes in the cloud (Stores all your music in icloud) plus subject to subscription iTunes match.
    8.ios app sync across devices.
    Plus new in 2012
    Invite friends to view photos and or movies via email link.
    What it do not do
    Allow you to drag and drop any file type from Finder/Explorer to remote storage (a la idisk or Drop box)- This may change as the service develops.

  • How to display.xls, pdf, .doc files in UIImageView within a UIScrollView.

    Hi,
    I am new to iPhone programming. I need some help.
    I want to display .xls, pdf, .doc files in UIImageView within a UIScrollView programtically how can i do this. What is the procedure.
    Pls. provide me a sample application.
    If anyone knows pls. respond it would be of great help for me.
    Thanks in Advance,
    Regards,
    Sreelatha.

    Hi Sreelatha. The best example code for your purpose is the Scrolling sample app I referred to previously. The word Scrolling in that post is a link to the download page. I think that code will answer all your questions about how to init a UIImage, then use it to init a UIImageView, and then position the UIImageView frame in a UIScrollView. Two cases are demostrated: 1) Scrolling horizontally through a series of images; 2) Scrolling both H & V over a single image which is several times larger than the window.
    You might also be interested in the PageControl sample app in case you want to add a page control to your scroll view.
    Reading your last post again... I sure hope we've been discussing images (like jpegs?) in this thread. This isn't about reading and rendering the actual xls, pdf and doc files, is it?? Of course the iPhone handles html beautifully, so for example, an html representation of a doc file would play nicely. But in that case you'd want a UIWebView, not a UIImageView.

  • Checking PDF/DOC/XLS files for passwords

    Folks
    Wondering if anyone can shed any light on how to check PDF/DOC/XLS files passwords?
    I'm not trying to crack the password, I'm writing a program where people are uploading files, but I don't want people submitting files that require passwords to open them.
    Tom

    shashi_rajak wrote:
    Open Source PDF Libraries in Java
    http://java-source.net/open-source/pdf-libraries
    use any one of library given in the above page. then try to read the pdf file . if you are able to read then it is not password protected .Or invalid, or too new, or has other featues that those libraries might not support.

  • To visualize pdf, doc in blobs

    Its possible, to allow the visualization of the content of archives pdf, DOC that had been stored in the type blob (in the Edit Value window of the blob column)?

    Rendering PDFs and Microsoft Word Docs is a pretty big ask.
    Have you looked into CTX_DOC ?
    You may be able to do a view that will convert the document blob into text in a CLOB
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:25695084847068
    May give you an idea

  • Asha 302 - PDF/Doc/Xls reader issue

    I have downloaded ezreader from store for reading pdf/doc/xls files. After installation of the application i cannot open the file tree. As i select open from the ezreader window it shows c: and e: drives, but selecting any of the drives will return the screen to ezreader home window. Can somebody help on this. Without a file opening option the the mail functionality of Asha302 is of no use.

    I also have this problem, & its a pain. Im pretty well computer illiterate & have used nokia for online use due to their ease in the past but they've really dropped the ball with the Asha 302. I had an E63 last, & had no problem with it. I had a lot of downloaded files saved to the memory card, & when the E63 recently stopped working I got the asha as I was told it was an upgrade (yeah right). I transfered the sim & memory to the asha, & now, not only cant I open pdf files etc online, but I cant access the saved files, including files I recieved attached to emails that are saved to the memory card. I have downloaded the ezereader with the same results others have describe,,, it dont work. Thinking I may have been doing something wrong due to lack of knowledge, I went to the Optus shop where I bought the POS asha302 & asked for them to assist. Well after wasting over an hour & a half while they unsuccessfully tried I was told the best thing to do would be to buy a card reader so I could at least access the files that are on the memory card via computer. Still means I've been ripped off on the phone, doesnt it

  • PDF doc error : filedownloadUI vs.   cl_wd_runtimeservices= attach_file_to

    I have a strange problem.
    I need to download a pdf doc from DMS.  I got the external bapi call that returns the file binary data as array of 2550 length rawdata ('x') type.
    I convert this into XSTRING and use filedownloadUI to open it.
    Works FINE!!
    However, the
    following code , attached to a button action, calling attach_file_to_response does not work.  
      call method cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename  = line_Filecontent_Node-filename
          i_content   = line_Filecontent_Node-filecontent
          i_mime_type = line_Filecontent_Node-mimetype.
    *    i_in_new_window = abap_true
    *    i_inplace       = abap_false.
    The following code, linked to filedownloadUI is working:
    types:  char3(3).
    types:  char255(255).
    data: dappl type char3.
    data: filename type char255.
    data: dms_content type table of YBAPI_DMSCONTENT initial size 0.
    field-symbols <content> like line of dms_content.
    data: BIN_FILESIZE              TYPE      I.
    types: field2550(2550) type x.
    data: content_binary type table of field2550 initial size 0.
    field-symbols <content_binary_row> like line of content_binary.
    data: loopCount type i,
          xstringTab type table of xstring.
    data xstringRow  type xstring.
    data datastream  type xstring.
    ***** for xstring conversion ******
    data conv_out type ref to cl_abap_conv_out_ce.
    conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
      loopCount = 0.
      data: counter type i,
            xlen type i,
            totalRead type  i,
            remain2read type i.
      loop at dms_content assigning <content>.
        bin_filesize = <content>-length.
        counter = <content>-counter.
        loopCount = loopCount + 1.
          xlen = 2550.
          at last.
            totalRead = ( loopCount - 1 ) * 2550.
            remain2read = <content>-length - totalRead.
            xlen = remain2read . "603.
          endat.
        conv_out->convert(
        exporting
          data = <content>-data(xlen)
        importing
          buffer = xstringRow ).
        append xstringRow to xstringTab.
      endloop.
      concatenate LINES OF xstringTab into datastream in byte mode.
      Stru_Filecontent_Node-FILECONTENT = datastream. 
      case dappl.
        when 'doc' or 'DOC'.
            Stru_Filecontent_Node-MIMETYPE = 'application/word'.
        when 'xls' or 'XLS'.
            Stru_Filecontent_Node-MIMETYPE = 'application/excel'.
        when  'pdf' or 'PDF'.
             Stru_Filecontent_Node-MIMETYPE = 'application/pdf'.
        when others.
              Stru_Filecontent_Node-MIMETYPE = 'plain/text'.
      endcase.
      node->bind_structure( Stru_Filecontent_Node ).
    endmethod.
    However, both segments of code works for other types of file, like office docs, tiff image, jpg, etc.
    Only on PDF, we have problem.
    Please help.

    Hi Cathy,
    Im also developing a WDA application to download a document from DMS, Can u share the Function module which returns the X string value, so that i can use the file download UI element to download the Document...
    Actually i tried calling the FM CV120_Start_application, but im getting "Not supported by Gui" Exception...
    Please help me Cathy, its really urgent....
    Thanks in advance....
    James...

  • Print images in a pdf doc

    Hi,
    I'm inserting a gif image (logo from a png file) into a word
    doc and converting it to pdf. When I print the pdf file the logo
    appears very blurry (low quality). What am I doing wrong? Any help
    is appreciated!
    Thanks,
    Susannah

    SusannahR wrote:
    > Hi,
    >
    > I'm inserting a gif image (logo from a png file) into a
    word doc and
    > converting it to pdf. When I print the pdf file the logo
    appears very blurry
    > (low quality). What am I doing wrong? Any help is
    appreciated!
    You'll need to increase the PPI of the image to at least 96
    (180 is
    better) for it not to look fuzzy.
    Linda Rathgeber [PVII] **Adobe Community Expert-Fireworks**
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/
    Design Aid Kits:
    http://www.webdevbiz.com/pwf/index.cfm

  • Saving a PDF as a jpg in Preview

    Until I recently got my new MAC and upgraded to Lion 10.7.4, I was able to crop an image out of a pdf and save it as a jpg in Preview.
    Now you can only 'save a version' of a pdf and because no dialogue box opens, I don't know if its possible to save it in different formats or frankly where it saves to!
    Is there another way to save images in word docs or pdf's as jpgs?

    Duplicate it then you can save the duplicate in another format.
    The lack of "Save As" causes a lot of confusion.

Maybe you are looking for

  • Custom search help

    Hi expert, I want to create a search help that read data from a table and show this data, but only a selection of this data and not all. So, I created a custom search help, with an exit search help ( refernce at F4IF_SHLP_EXIT_EXAMPLE ). Inside this

  • New Macbook - import songs from iTunes on Windows

    Hi, Hope someone can make a suggestion. Just started using a macbook and would like to transfer my itunes library from my Windows PC to the macbook without having to create 50 cds. my ipod is formatted for windows and I know I'll need to reformat it

  • Watching my Blueray/DVD movies on my iPad Air

    I want to watch my Blueray/DVD movies on my iPad Air. I have a PC with a Blueray optical drive. How do I do that?

  • I load FF then w/in short time it demands I load it again - why? What do I need to do?

    I have continued to install as requested but recently it keeps asking me to install it again after I've already done so - driving me nuts! What am I not doing or need to do to get things back on track? Ok to call if needed: 702-645-5196 (I'll call ba

  • Profit Center Group Organization Change - Effective for Prior Periods

    Hi Experts, A client wants to perform a horizontal organization change (profit centers) and see the effects retroactively to the prior periods.  To achieve this, they plan to re-execute the consolidation tasks going back two to three years once the o