To print a BLOB

Hello, I have a file pdf in a field BLOB and need to print it, without opening it before. Hay some way to do it? Thanks

Hi Yiri,
Your post raises many questions:
1. What version of Forms are you using?
2. Are you running client/server forms, or web forms?
My general approach would be to read the blob into a byte array using a Java bean, write the byte array to a temporary file on the client machine, and finally print the temporary file. I'm guessing that when you say "without opening it", you really mean that you do not wish for the user to see Acrobat (or equivalent) running. If so, you may be able to automate Acrobat without actually showing the application.
It is possible to copy PostScript files directly to a PostScript printer -- some newer printers may be smart enough to accept a PDF stream direcly. If you do have a PostScript printer, there exist utilities like pdf2ps for converting PDF to PostScript. Programmatically copying a file directly to a printer, however, is beyond my experience. If you're running on Windows, my guess would be to research its spooling facilities.
Sorry I can't offer more help, but perhaps this will point you in the right direction. In any case, please share your findings with the group.
Eric Adamson
Lansing, Michigan

Similar Messages

  • How to print a BLOB (image) on a PDF report using Oracle APEX Listener as Print Server

    Hi,
    I use APEX 4.2.
    I have the following query as SQL text for a Report Queries in Shared Components:
    select
        customer_id,
        cust_first_name,
        cust_last_name,
        cust_street_address1,
        cust_street_address2,
        cust_city,
        cust_state,
        cust_postal_code,
        phone_number1,
        phone_number2,
        credit_limit,
        cust_email,
        filename,
        company_profile,
        -- customer_image,
        decode(nvl(dbms_lob.getlength(customer_image),0),0,null,
        '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '||
        'src="' ||
        apex_util.get_blob_file_src('P22_CUSTOMER_IMAGE', customer_id) ||
        '" height="75" width="75" alt="Photo Customer" title="Photo Customer" />') customer_image,
        mimetype,
        image_last_update
    from
        demo_customers;
    I am unable to have the image printed on the PDF report. Even when the P22_CUSTOMER_IMAGE is defined as session state item.
    Does someone knows how to print such image/BLOB in a PDF report?
    Thanks by advance.
    Kind Regards.

    Hi,
    Indeed, I would need a custom layout.
    Unfortunately, it seems (according to this white paper) not possible with the APEX listener only. I would need a third pary tool. A pity...
    For me strange, that I cannot generate such a report having images or pictures in a pre-definied report layout... Maybe a future enahancement for Oracle.
    Kind Regards.

  • PDF Image printing, base64encoded blobs

    Hi guys!
    I'm trying to extract images from a table (blob) and put it in a PDF-report, through ApEx.
    After reading this blogpost about image-blobs in reports(http://blogs.oracle.com/xmlpublisher/2006/05/05#a34) I thought "this was interesting, this is exactly what my customer want". So, I made a function to dump the blob as base64-data (found some codesnippets here and there..):
    function BLOB2CLOBASE64( p_blob IN BLOB ) RETURN CLOB
    IS
    pos PLS_INTEGER := 1;
    buffer VARCHAR2( 32767 );
    res CLOB;
    lob_len INTEGER := DBMS_LOB.getLength( p_blob );
    BEGIN
    DBMS_LOB.createTemporary( res, TRUE );
    DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
    LOOP
    buffer := utl_raw.cast_to_varchar2(utl_encode.base64_encode( DBMS_LOB.SUBSTR( p_blob, 32000, pos )));
    IF LENGTH( buffer ) > 0 THEN
    DBMS_LOB.writeAppend( res, LENGTH( buffer ), buffer );
    END IF;
    pos := pos + 32000;
    EXIT WHEN pos > lob_len;
    END LOOP;
    RETURN res; -- res is OPEN here
    END BLOB2CLOBASE64;
    Works great! I get the imagefile dumped as base64.
    So, time to try this out. I make a Report query in ApEx, and
    do a
    "select blob2clobase64(image_file) IMAGE from testphotos"
    XML gets dumped, and I can load it into my BI Publisher Desktop/Word. I do like it's done in the blogpost above, and enter the following for the IMAGE-field:
    <fo:instream-foreign-object content-type="image/jpg">
    <xsl:value-of select="IMAGE"/>
    </fo:instream-foreign-object>
    (In the examplecode from the above blog-link; see how this code is entered in the Help-section when you do "Properties" for the field).
    Ok, here goes, let's give it a try: Preview -> PDF and out pops two wonderful pictures that's in my table 'testphotos '. Hooray!
    I save the template, and upload it to ApEx through the Create Report Query-wizard. Go to the last page. Press "Test query". Out comes: A PDF-file with all the text from the template, but no pictures.
    What have gone wrong? Any inputs?
    Thanks for now,
    Vidar
    PS: Size of the 2 images together is 10-15kb max.
    PS2: Application Express 3.0.0.00.20
    Message was edited by:
    Vidar
    : added apex versioninfo

    Hello
    Just wanted to give this a bump, as I made this thread just before the weekend. It's dropped quite long, so thought I'd bring it upfront again now that people might be back.
    Regards,
    Vidar

  • Display BLOB File (pdf format) from database inside Oracle Form (6i)

    hi all.
    Apologies for a primitive question owing to the fact that i m new to development. I have a requirement to display a pdf document with in an oracle form. i want to know is there any such control for that? or any hint how to go about it?
    thanks in advance

    Here I have found my jsp script...
    How I get the PDF?
    I call my script from pl/sql with
    web.show_document('http://my_server/getblob.jsp?id=' || id_from_my_blob_table || '&baza=myhost:1521:sid','_blank');
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.text.*" %>
    <%@ page import="oracle.jdbc.driver.OracleDriver" %>
    <%@ page import="oracle.jdbc.driver.OracleResultSet" %>
    <%
    Connection con = null;
    Statement stmt = null;
    ResultSet rs= null;
    oracle.sql.CLOB clob = null;
    oracle.sql.BLOB blob = null;
    String datoteka = "";
    String host = "http://" + request.getHeader("host") + "/";
    %>
    <!--Peter Valencic 2003 -->
    <html>
    <head>
    <title></title>
    </head>
    <%
       String tip ="";
       String id ="";
       String baza ="";
       String shema ="";
    try
       id = request.getParameter("id");
       baza = request.getParameter("baza");
       shema = request.getParameter("shema");
       if (request.getParameter("id")== null)
          throw new Exception("id= null");
       else if(request.getParameter("id").equals(""))
          throw new Exception("id= null");
       if (request.getParameter("baza")== null)
          throw new Exception("baza= null");
       else if(request.getParameter("baza").equals(""))
          throw new Exception("baza= null");
       if (request.getParameter("shema") == null)
         shema ="";
       else if (request.getParameter("shema").equalsIgnoreCase(""))
         shema="";
       else
         shema =shema + ".";
    catch(Exception e)
       out.println("Priąlo je do napake: " + e.toString());
       return;
          try
                Class.forName("oracle.jdbc.driver.OracleDriver");
                con = DriverManager.getConnection("jdbc:oracle:thin:@"+baza,"your_user","your_password");
                stmt =con.createStatement();
                rs = stmt.executeQuery ("Select * from "+shema+"DOK_VSEBINA_DOKUMENTA_BLOB where ID="+id);
                boolean podatkib = rs.next();
                if (!podatkib)
                   out.print("<li>Ni podatkov za  ID="+id);
                   return;
                blob = ((oracle.jdbc.OracleResultSet)rs).getBLOB("VSEBINA");
                datoteka = rs.getString("NAZIV_DATOTEKE").toUpperCase();
                   File blobFile = new File(application.getRealPath("/uploads/blob")+"/"+datoteka);
                blobFile.createNewFile();
                InputStream podatki = blob.getBinaryStream();
                FileOutputStream strBlob= new FileOutputStream(blobFile);
                int size = blob.getBufferSize();
                byte[] buffer = new byte[size];
                int length = -1;
                while ((length = podatki.read(buffer)) != -1)
                   strBlob.write(buffer,0,length);
                podatki.close();
                strBlob.close();
                con.close();
                out.print("<li>"+host+"in2/uploads/blob/"+datoteka);
                   response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
                //odpremo z jsp-stranjo datoteko..
                //response.sendRedirect("");
          catch(Exception blobException)
             out.print("<li>(BLOB)Napaka pri prebiranju podatkov:</li>"+blobException.toString());
             return;
    out.println("konec..");
    %>
    <body>
    <form method="post">
    Vnesi ID
    <input type=text name="id">
    <li> <input type=submit name="potrdi" >
    </form>
    </body>
    </html>If you look my "old" script..
    first it get 2 parameters baza= database (ip:port:sid), id= id from my table (PK)
    at the end of my script I have:
    response.sendRedirect(host+"in2/uploads/blob/"+datoteka);
    this redirect will redirect you to your file stored on server side..
    Because IE knows what file it must open it will open it with PDF reader...
    hope this help you..
    Edited by: peterv6i.blogspot.com on May 14, 2012 11:14 AM

  • Custom Filename for PDF Report

    Hi,
    I have a requirement to download pdf for a report. I provided the download action as a column link on the report. Clicking the link I direct to the URL for the custom report I created (f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT= MyReport). Pdf gets downloaded with the name MyReport.pdf. But I need to provide a custom name for the downloaded pdf, it should be based on the Id value of the report column something like this Emp123.pdf where 123 is the employee Id (selected row's employee id value in my report).
    I searched in the forums and came across this thread APEX 3 PDF Report Export Custom Filename? but here its mentioned that
    " In this case there's no separate attribute for the file name. And we don't do substitutions on the report query name, so setting the name dynamically as you described in your sample, won't be possible. "
    Since the thread is a old one so posting a new one. Any pointers is highly appreciated.
    Thanks,
    Rakesh

    1. Call the report with utl_http.
    2. Store the output as a BLOB. Either local variable or store it in a table.
    3. Print the blob.
    Here is how you can print the blob and read the package spec for utl_http.
    Re: display a blob on webpage using mod-plsql

  • Saving report in excel format

    I need to save a report directly to excel format. The user does not want to open a delimited file in excel. After a lot of trials I got excel.prt file which supposedly saves the report in excel format directly from the PRINT TO FILE option.
    But I am still getting the option to save the file as text only, not in excel.
    Required help urgently as the report is important to the client

    We run reports using utl_http and then save the output as a blob. After that, we print the blob but before hand, we do this:
    owa_util.mime_header('application/vnd.ms-excel', false);
    htp.p('content-disposition: filename='||v_rec.filename||'.xls');
    owa_util.http_header_close;
    This sets the filename correctly and forces the browser to use Excel to handle the file.

  • Save report as pdf in the database

    Hi all,
    is it possible to save the generated pdf from reports10g in the database?
    Regards

    Here is what I was looking for:
    re:How to get cookie information or http headers values inside Oracle reports
    pr_example in the above forum was written under 8i. In 9i, they added the timeout which is set to a default of 60 seconds. Look at the UTL_HTTP package spec on more information on setting this timeout.
    Plus, printing the BLOB is easier too. You can just use wpg_docload.download_file instead of using the while loop.
    Anyway, that example shows you how to call a report from a stored procedure, store it in a blob, and even it print it back to the browser.

  • All suggestions for better reporting solution will be much appreciated!

    Hi there,
    I have a requirement (Reports 6i C/S) to print out a number of word documents (stored as BLOBS in a table) and the associated notes data. Here is the table structure
    SQL> desc cip_cases
    Name                            Null?    Type
    CIP_CASE_ID                   NOT NULL NUMBER
    CIP_CASE_REASON_ID              NOT NULL NUMBER(7)
    CIP_ID                          NOT NULL NUMBER
    DATE_ENTERED                    NOT NULL DATE
    ENTERED_BY                      NOT NULL VARCHAR2(30)
    NOTES                                    VARCHAR2(2000)
    CASE_DOCUMENT                            BLOB
    QUEUED_FOR_DELETION                      VARCHAR2(1)
    QUEUED_FOR_DELETION_BY                   VARCHAR2(30)
    SQL>Now I can produce a simple report to preview / print the DATE_ENTERED, ENTERED_BY, and NOTES fields and I have developed code to print the BLOB documents in the background using OLE but once the Word docs are printed out there is no way to link them up to the corresponding notes.
    Therefore the next most obvious solution (to me anyway) is to print out a single notes record followed by the corresponding word doc, followed by the next notes record and so on and so forth. Then at least they should come out on the printer in the correct order.
    It doesn't sound particularly elegant so I was wondering if anyone had a better idea?

    I guess no-one has any suggestions then?

  • Bad ink (AGAIN)

    Bought ink (AGAIN) for my all in one, has printed little blobs of black ink all over my customer billing and then when I needed to print pictures for Christmas presents (the MAIN reason I bought this printer) it was nothing but a big black blob allllllll over my pictures!  One big smudge - NOT happy.  I have a Canon sitting in my closet that a someone gave me, if you want to charge me almost $40 for one ink cartidge and have it NOT do what I bought it to do, I have NO problem moving everything over to Canon.  Then when it's time to get my new PC, I'll get my Dell.  Never had a problem with your ink, so why now? because when I needed it to perform it won't??  the store I bought it from won't return it, said I had to deal with the company, yup I can see I'll get results.....

    Can you provide a scan of the bad printout?  When you were printing photo's were you using photo paper?  The black cartridge is not used at all to print on photo paper.  
    Try the following:  with the printer  turned on press the * and # buttons together, then press 1 2 4.  This should bring up a menu that says underware.  Press the right arrow, OK, 10, OK.  This will print a diagnostic page.  After the page prints press the cancel button twice, this should return the menu to normal. 
    Now examine the printed page and please report the contents of items 64, 65, 66 and 67 on the test page.  If the page shows the defect please scan the page and post it here as an attachment.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • How To Print the contents of a BLOB Column on a report?(Word Document)

    Requirement: The word document will be inserted in a BLOB Column and the data in the word document has to be shown on the reports or the user should be able to see the word document (atleast he should be able to view the contents)?
    The data is getting loaded in the database but not sure how to proceed further.
    Any inputs on how to proceed will be appreciated.
    Thanks.

    in JComponent there is a method called print(Graphics g)
    you can use that with a Printable class
    read bout the java.print package in the java doc

  • Can you print the contents of a blob in Bi Publisher

    For example, Bi Publisher generate a pdf file in apex that will print the contents of a blob.
    Let's say you have a record with test.xls in a blob, can I take the test.xls out of the record and have bi publisher print it.
    Thanks,
    Doug

    BI Publisher can add some blobs to a report, such as a .jpg / .gif / .png, but excel just doesn't make sense, nor do I think it would work.
    Tyler Muth
    http://tylermuth.wordpress.com
    "Applied Oracle Security: Developing Secure Database and Middleware Environments": http://sn.im/aos.book

  • Printing a PDF from an imbeded xls file in a blob

    Let me explain
    I am using BI Publisher to print PDF files, it works good.
    The problem is now the user wants the xls file in the blob of that record to also appear in the pdf
    for example
    table test1 has columns name char(8), account char(10), xlsfile blob
    they want to pdf to have
    name
    account
    the xls file
    Is this possible???

    Can someone answer this thread, if you want more explanation, i can provide it.
    Thanks,
    Doug

  • Actually PRINT (i.e. spool to a printer) a PDF stored in the DB as a BLOB

    Hi Folks.
    I have got APEX to generate PDF files for me based on a shared components query & report template. These are stored in the database as BLOB.
    Is there a way to send these BLOB PDF files directly to a printer?
    I don't want to have to export the files to the server file system and then have the user manually select them from there for printing. Ideally I want the users to select the documents for printing in the UI and these then get spooled to the printer.
    If anyone has a suggestion/steer for me, I'd love to hear it.
    Many thanks
    Simon.
    Application Express 3.1.1.00.09
    Database 10.2.0.3.0
    BI Publisher 10.1.3.3.2

    Hi Tyler
    OK, here's where I'm at...
    Got SoapUI 2.0.2
    Creating a new project
    Setting initial WSDL to http://xx.xxx.x.xx:9704/xmlpserver/services/PublicReportService?wsdl
    (Real IP substitued with 'x' for security)
    'Create Requests' - Checked
    'Create Project File' - Checked
    When I press 'OK' I get an error message stating...
    "com.eviware.soapui.support.SoapUIException: Error importing wsdl"
    A bit more info.
    If I enter the following into my browser address bar...
    http://xx.xxx.x.xx:9704/xmlpserver/services/PublicReportService
    I get...
    PublicReportService
    Hi there, this is an AXIS service!
    Perhaps there will be a form for invoking the service here...
    And If I enter...
    http://xx.xxx.x.xx:9704/xmlpserver/services/PublicReportService?wsdl
    I get...
    AXIS error
    Sorry, something seems to have gone wrong... here are the details:
    Fault - ; nested exception is:
         oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.
    AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: oracle.xml.parser.v2.XMLDOMException: Implementation does not support the object requested.
    faultActor:
    faultNode:
    faultDetail:
         {http://xml.apache.org/axis/}hostname:xxXXXX
    Am I missing something?
    Kind regards
    Simon.

  • How to print JPG image retrieved from BLOB in a table using Forms10g

    I create a database schema and a Form to maintain JPG to the table PHOTOS.
    I would like to add a button to PRINT just the PHOTO_IMAGE to its maximum size from a Form. How can I do that? Is thaere any built-in Forms functions to do that? If the client is using Windows XP, can I use CLIENT_HOST() to call a program to print the JPG file directly?
    Any suggestion is welcome.
    -- myphotos.sql
    drop user myphoto cascade;
    create user myphoto identified by myphoto;
    grant connect, resource, ctxapp to myphoto;
    connect myphoto/myphoto@orcl;
    PROMPT Creating Table USERS
    CREATE TABLE USERS
    (USER_ID VARCHAR2(8) NOT NULL,
    USER_LASTNAME VARCHAR2(15) NOT NULL,
    USER_FIRSTNAME VARCHAR2(30) NOT NULL,
    USER_PASSWORD VARCHAR2(20) NOT NULL,
    CONSTRAINT PK_USERS PRIMARY KEY (USER_ID)
    PROMPT Creating Table PHOTOS
    CREATE TABLE PHOTOS
    (PHOTO_ID VARCHAR2(15) NOT NULL,
    PHOTO_IMAGE BLOB,
    TEXT_DESCRIPTION CLOB,
    FILENAME VARCHAR2(50),
    FILE_SIZE NUMBER NOT NULL,
    USER_ID VARCHAR2(8) NOT NULL,
    ACCESS_RIGHT VARCHAR2(7) NOT NULL,
    CONSTRAINT CK_ACCESS_RIGHT CHECK (ACCESS_RIGHT IN ('PRIVATE', 'PUBLIC')),
    CONSTRAINT PK_PHOTOS PRIMARY KEY (PHOTO_ID),
    CONSTRAINT FK_USER_ID FOREIGN KEY (USER_ID) REFERENCES USERS (USER_ID)
    create index idx_photos_text_desc on
    PHOTOS(TEXT_DESCRIPTION) indextype is ctxsys.context;
    INSERT INTO USERS VALUES ('G345566A','WONG', 'TAI SIN','WONGTAISIN');
    INSERT INTO PHOTOS VALUES
    ('P00000000000001', empty_blob(), empty_clob(),
    'SCGP1.JPG',100,'G345566A','PUBLIC');
    INSERT INTO PHOTOS VALUES
    ('P00000000000002', empty_blob(), 'Cold Play with me at the concert in Melbourne 2005',
    'COLDPLAY1.JPG',200,'G345566A','PUBLIC');
    INSERT INTO PHOTOS VALUES
    ('P00000000000003', empty_blob(), 'My parents in Melbourne 2001',
    'COLDPLAY1.JPG',200,'G345566A','PRIVATE');
    COMMIT;
    EXEC CTX_DDL.SYNC_INDEX('idx_photos_text_desc');
    SELECT USER_ID,PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS
    ORDER BY USER_ID;
    SELECT score(1),PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS
    WHERE CONTAINS(TEXT_DESCRIPTION,'parents',1)> 0
    ORDER BY USER_ID,score(1) DESC;
    SELECT USER_ID,score(1),PHOTO_ID ,TEXT_DESCRIPTION
    FROM PHOTOS
    WHERE CONTAINS(TEXT_DESCRIPTION,'cold play',1)> 0
    ORDER BY USER_ID,score(1) DESC;
    SELECT USER_ID,score(1),score(2), PHOTO_ID ,TEXT_DESCRIPTION
    FROM photos
    WHERE ACCESS_RIGHT='PUBLIC'
    AND CONTAINS(TEXT_DESCRIPTION,'Melbourne',1)> 0
    AND CONTAINS(TEXT_DESCRIPTION,'2005',2)> 0
    ORDER BY USER_ID,score(1) DESC;

    I use a third part product to do this (irfanview.exe).
    This tool allows to do some batch operation /print to print the file)
    Francois

  • Printing Word Document stored in BLOB from Reports

    I have stored images and MS-Word documents in the DB in a BLOB column. Using reports 6, I am able to print the images by setting the File Format property of the item to Image. What I need to know is how can I print the Word document that has been stored in the DB using reports? Any alternative suggestions welcome...
    Thanks for your help.
    Aparna

    Hi Aparna,
    I have tried the same with CLOB instead BLOB.
    (MS Word)
    Only problem is (as expected) any graphics (BOLD, Table etc) will not work when printing. It also replaces the TABS with A single space.
    If you have found an answer, please let me know.
    Tissa
    ([email protected])
    null

Maybe you are looking for