Apache FOP PDF Save in BLOB column

Hi,
I just want to call Apache FOP in an APEX process to create PDF reports and save these reports in a BLOB column in the same database. So I can email these reports in another process using APEX_MAIL. Does anyone know a way to achieve this?
Thanks

If I understand correctly, your requirements needs to be broken down into two problems:
1) click link that pops up a window displaying a new APEX page
2) an APEX page the displays the document, not downloads it.
I haven't done #1 (yet).
However, you may be able to generate a URL that points to the new page as part of the SELECT statement for the Report.
This has a related question, but no answer yet:
open pdf in popup browser window
The key is target="_blank" for the anchor tag.
To generate the URL, you should use the APEX_UTIL.prepare_URL() function.
If that doesn't work, a Dynamic Action that does some magical JavaScript stuff may be needed.
For #2, I lost the URL that showed how to display a PDF as part of a "form" page.
From what I remember:
Start with a blank page with one blank HTML region (all the Items go in the HTML region)
Add an Item for the PK/Doc_ID
part I forgot Create a Data Manipulation Process
- Automated Row Fetch
- On Load - After Header
- (stuff for your table/view)
part I forgot Create an (I believe) "File Browser" item type. For Settings:
- Storage Type "BLOB column specified in Item Source" (and place the column name of the BLOB there)
- MIME Type Column: (column name) -- since you have multiple types, this is a MUST HAVE
- Filename Column: (column name) -- I highly recommend you have this.
- Content Disposition == INLINE <-- this is the kicker
Also, you will need a Browser Plugin for each of the MIME Types (otherwise, the browser may try to 'download' the file)
Browsers can handle Image types internally. Adobe's plugin can handle PDFs. I don't know about Word/Excel.
Again, I don't remember the exact details, but that should cover most of it.
MK

Similar Messages

  • Display a PDF from a BLOB Column on a page.

    Hi Folks.
    I have PDFs stored in BLOB columns in the database.
    Is there a way to display these to the APEX user on the page at runtime?
    Any pointers appreciated.
    Meantime I'm going to experiment.
    Cheers
    Dogfighter.

    I suppose this depends really on what you want.
    You have at least two choices.
    1) Allow the user to download the pdf and then they get the option to save it or open it in a new window
    2) You can also get them to open it. You can open it in a new window by adding "_blank"
    in the target.
    The sample application has procedures download_my_file and custom_image_display which will show you how to achieve this.
    The only other way you could possibly do it is open it as a plugin. Thats way beyond my knowledge, but I'm sure someone else will chip in.

  • Problem displaying PDF stored in BLOB column

    Hello everyone.
    I've been trying to follow this tutorial http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::p11_question_id:232814159006 on displaying PDFs stored in BLOB columns. This is being performed on Apex 4.2, with my DB running 11g. I've got my procedure, which I'll post below:
    create or replace procedure "PDF" (p_id IN gvo_documents.doc_id%type)
    is
        l_lob    blob;
        l_amt    number default 30;
        l_off   number default 1;
        l_raw   raw(4096);
    begin
        select contents into l_lob
            from gvo_documents
             where doc_id = p_id;
    -- make sure to change this for your type!
        owa_util.mime_header( 'application/pdf' );
        begin
            loop
              dbms_lob.read( l_lob, l_amt, l_off, l_raw );
              htp.prn( utl_raw.cast_to_varchar2( l_raw ) );
              l_off := l_off+l_amt;
              l_amt := 4096;           
        end loop;
            exception
               when no_data_found then
                  NULL;
            end;
    end;
    I am trying to run this through a PL/SQL dynamic region and while I don't receive any error's, the content displayed is a huge mess of garbled text and odd characters. I've tried to run this procedure on numerous other document types, including word files and jpeg images, all with the necessary changes in my procedure, and regardless of what I use, I still get a large mess of strange characters. Does anyone have any information or ideas about why this is happening?

    If I understand correctly, your requirements needs to be broken down into two problems:
    1) click link that pops up a window displaying a new APEX page
    2) an APEX page the displays the document, not downloads it.
    I haven't done #1 (yet).
    However, you may be able to generate a URL that points to the new page as part of the SELECT statement for the Report.
    This has a related question, but no answer yet:
    open pdf in popup browser window
    The key is target="_blank" for the anchor tag.
    To generate the URL, you should use the APEX_UTIL.prepare_URL() function.
    If that doesn't work, a Dynamic Action that does some magical JavaScript stuff may be needed.
    For #2, I lost the URL that showed how to display a PDF as part of a "form" page.
    From what I remember:
    Start with a blank page with one blank HTML region (all the Items go in the HTML region)
    Add an Item for the PK/Doc_ID
    part I forgot Create a Data Manipulation Process
    - Automated Row Fetch
    - On Load - After Header
    - (stuff for your table/view)
    part I forgot Create an (I believe) "File Browser" item type. For Settings:
    - Storage Type "BLOB column specified in Item Source" (and place the column name of the BLOB there)
    - MIME Type Column: (column name) -- since you have multiple types, this is a MUST HAVE
    - Filename Column: (column name) -- I highly recommend you have this.
    - Content Disposition == INLINE <-- this is the kicker
    Also, you will need a Browser Plugin for each of the MIME Types (otherwise, the browser may try to 'download' the file)
    Browsers can handle Image types internally. Adobe's plugin can handle PDFs. I don't know about Word/Excel.
    Again, I don't remember the exact details, but that should cover most of it.
    MK

  • How to store PDF file in BLOB column without using indirect datastore

    Hi ,
    I want to store a pdf file in a BLOB column.
    But , it should be a direct store. I cannot usre indirect datastore.
    BLOB column doesn't support indirect datastore. I get the following error.
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-20000: Oracle Text error:
    DRG-10581: indirect datastores cannot be used with long or lob text columns
    ORA-06512: at "CTXSYS.DRUE", line 160
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 365
    can anyone give me any clue onhow to manage this issue?

    Thanks This really helped.
    For other readers, I am summarising what I did.
    create table test
    id number primary key,
    docs BLOB
    create or replace directory doc_loc
    as 'c:\test';
    CREATE OR REPLACE PROCEDURE Load_BLOB_From_File (file_name in varchar2)
    AS
    src_loc bfile:= bfilename('DOC_LOC',Load_BLOB_From_File.file_name);
    dest_loc BLOB;
    begin
    insert into tkctsf15t values(1,empty_blob()) returning docs
    into dest_loc;
    dbms_lob.open(src_loc,DBMS_LOB.LOB_READONLY);
    DBMS_LOB.OPEN(dest_loc, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.LOADFROMFILE(
    dest_lob => dest_loc
    ,src_lob => src_loc
    ,amount => DBMS_LOB.getLength(src_loc));
    DBMS_LOB.CLOSE(dest_loc);
    DBMS_LOB.CLOSE(src_loc);
    COMMIT;
    end;
    show errors;
    exec Load_BLOB_From_File('test.pdf');
    exec ctx_ddl.create_preference('mylex','BASIC_LEXER');
    create index testx on test(docs) indextype is ctxsys.context
    parameters
    ('filter ctxsys.AUTO_FILTER LEXER mylex ');
    select id from test where contains(docs,'patch')>0;
    Thanks Roger once more

  • How to store a PDF in a BLOB column, then select/search it using SQL?

    We have a simple requirement.
    (1.) We have an Oracle 10g DB.
    (2.) We want to store PDFs/MS Word docs inside BLOB column in a table.
    (3.) We need to show PDF/MS Word content to the user, without opening the PDFs/MS World like we normally do (i.e. Using PDV reader/ MS Word).
    (4.) i.e. We need to use SQL statements and
          (a.) Get all contents of the PDF/MS WORD doc.
          (b.) Search for specific strings inside these docs in the BLOB columns.How to do this pls? Code sample would be really great.
    Edited by: user12240205 on Jul 18, 2012 9:35 PM
    Edited by: user12240205 on Jul 18, 2012 9:37 PM

    rp0428 wrote:
    >
    We have a simple requirement.
    >
    Really? You mean as opposed to a requirement that might actually be doable?Could be that simple is used as in stupid ? Like in, "+look at this simply idiotic requirement, blah.. blah...+"? ;-)
    @user12240205:
    BLOBs contains binary data. Not text data. How do you propose to search binary data for strings?
    PDF and Word formats include actual text strings and identifiers as part of the formatting. How do you propose that this be identified and ignored when searching for specific strings in the document's content?
    PL/SQL does not have the ability to take a page from a PDF/Word document, highlight the search string, and display that to the client. A format-parser is needed to parse the PDF/Word format and generate that as content (e.g. HTML or XML) that can be rendered by a client. How do you propose PL/SQL serves up search strings that it found, when it cannot interpret the document format? (cannot even say what page, section or paragraph, that search string occurs)
    Documents can be loaded via the DBMS_LOB interface. Either from the db server's file system, or by the client supplying the document as chunks for "write appending" to a BLOB. See Oracle® Database PL/SQL Packages and Types Reference guide for details.
    Text search and document indexing are supported by an Oracle feature called Content Management<a> (which includes interMedia, UltraSearch, Oracle Text, etc).
    Oracle also supports (on Window server platforms), the Microsoft Component Object Model (COM). COM interfaces (such as COM for Word) can be used for specialised processing (e.g. searching Word documents). Oracle's COM feature allows one to interface directly with external s/w (e.g. MS Word) via its COM interface.

  • APEX 4.1 - APACHE FOP PDF generation problem.

    Hi all,
    I'm having problem with PDF generation using APACH FOP on OC4J.
    When I test my print server as described here:
    http://marcsewtz.blogspot.com/2008/06/heres-another-posting-on-pdf-printing.html
    everything works without problem. But when I upload my Layout to APEX and try to generate PDF from apex I'm getting error:
    oracle.xml.parser.v2.XMLParseException: Unexpected EOF.
         at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320)
         at oracle.xml.parser.v2.XMLReader.popXMLReader(XMLReader.java:549)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1375)
         at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:362)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:308)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:337)
         at oracle.xml.xslt.XSLProcessor.newXSLStylesheet(XSLProcessor.java:714)
         at oracle.xml.xslt.XSLStylesheet.<init>(XSLStylesheet.java:322)
         at oracle.xml.parser.v2.XSLStylesheet.<init>(XSLStylesheet.java:114)
         at apex_fop._jspService(_apex__fop.java:71)
         [SRC:/apex_fop.jsp:21]
    I could see similar post here:
    Handling Special characters in call to apex_util.download_print_document
    But it doesn't explain my case as it's crashing even when I generate empty pdf(no data so no special characters, only empty XML file with no data should be sent to print server)
    Is there any way to see what xml is sent do print server for processing? That could eventually show where is a problem.
    Palo

    My mistake, there was really an "&" character in my template. now when I replaced it with %26 it works.
    However I would be still interested if there is a way to see what data is APEX engine sending to print server cause it will help me to find this kind of errors.
    Palo

  • Visual C++, CMap object save to blob column

    I have a MFC CMap object, each object stores 160K~ entries of long data. I need to store it on Oracle SQL. we decided to save it as a blob. since we do not want to make additional table. we also thought about saving it as local file and point the SQL column to that file, but we rather just keep it as blob on the server and clear the table every couple of weeks.
    The table has a sequential key as ID, and 2 column of time. I need to add the blob column in order to store on every row that CMap.
    Can you recommend a guide to do so (read/write Map to blob or maybe a clob) ? Thanks.

    The LOB exists in server memory. Your code cannot access that memory for a memcpy or similar calls. Your code deals with a LOB locator variable (another name for a pointer) - and casting this makes no sense. Casting it does not deference it.
    The DBMS_LOB PL/SQL interface exposes the basic interface for LOBs. This, and client drivers, use the OCI (Oracle Call Interface) under the hood.
    The OCI provides a ranges of features - including binding host variables (variables in your code) to bind variables (variables in PL/SQL and SQL calls to the database). See Oracle® Call Interface Programmer's Guide for binding LOBs.
    The functionality of the OCI needs to be exposed by whatever db abstract interface you use. If it does not do that properly, then you can use PL/SQL as the interface. Or call the OCI directly.

  • To upload a PDF file in BLOB column using Oracle 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.

    Take a look at the following :
    Re: Storing a PDF in a BLOB
    Re: Retrive Image from DB into Image_item
    although the threads above are reffered to images and word doc... the procedure/steps are the same....
    Greetings...
    Sim

  • 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;

  • PDF save to BLOB

    Hello All,
    we are using forms 10g, and there is a form in which a PDF report is created and mailed to the client. The requirement is while sending it as mail we need to save the PDF to the database, so we are uploading the file from the application server into the database server. The question is which mechanism can be used for that? is it webutil? if so it has a lot of configuration on application server side, so is there any faster way for that.
    Thanks in advance,

    If you were to install OAS10g, you could run your forms from there, and also make use of WebDAV. Oracle's WebDAV simply maps a file directory to the database: copy a file into a WebDAV directory, and the file is actually stored in the OAS Metadata Repository. Furthermore, you can set permissions on the WebDAV directories for users/groups.

  • LOGO in PDF file (Apache FOP)

    Hi all...I'm using the Apache FOP PDF printing option with the jsp packaged in the AppEx 3.0.1 install. I would like to put a logo in the header of the generated PDF file. I made a compy of the default generic columns layout and added this to the header section in Page Template:
    <fo:block>
    Test Header Changes
    <fo:external-graphic src="file:///tmp/FastenalLogo.png"/>
    </fo:block>
    The following error is then generated in the logs:
    07/10/31 10:50:44 [INFO] Using oracle.xml.parser.v2.SAXParser as SAX2 Parser
    07/10/31 10:50:44 [INFO] building formatting object tree
    07/10/31 10:50:44 [INFO] setting up fonts
    07/10/31 10:50:51 [INFO] [1]
    07/10/31 10:50:51 [WARNING] table-layout=auto is not supported, using fixed!
    07/10/31 10:50:53 [ERROR] Error while creating area : Error creating FopImage ob ject (file:/tmp/FastenalLogo.png) : Jimi image library not available
    07/10/31 10:50:54 [INFO] [2]
    07/10/31 10:50:55 [ERROR] Error while creating area : Error creating FopImage ob ject (file:/tmp/FastenalLogo.png) : Jimi image library not available
    07/10/31 10:50:55 [INFO] [3]
    07/10/31 10:50:55 [ERROR] Error while creating area : Error creating FopImage ob ject (file:/tmp/FastenalLogo.png) : Jimi image library not available
    07/10/31 10:50:56 [INFO] Parsing of document complete, stopping renderer
    I also tried using a URL (with appropriate syntax), but that generated these errors:
    07/10/31 10:44:14 [ERROR] Error while creating area : No ImageReader for this ty pe of image (http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg)
    07/10/31 10:44:14 [INFO] [3]
    07/10/31 10:44:15 [ERROR] Could not load external SVG: http://epsilon.fastenal.c om:7784/i/FastenalLogo.jpg<Line 1, Column 50>: XML-20190: (Fatal Error) Whitespa ce required.
    07/10/31 10:44:15 [ERROR] Error while creating area : No ImageReader for this ty pe of image (http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg)
    07/10/31 10:44:15 [INFO] Parsing of document complete, stopping renderer
    Is it not possible to import an external image file into a PDF rendered by the Apache FOP? Any help would be greatly appreciated.
    Thanks,
    Leigh

    Hi Carl --
    I changed the image source to this:
    <xsl:variable name="_SECTION_NAME" select="string('master0')"/>
    <fo:static-content flow-name="region-header">
    <fo:block>
    Test Header Changes
    <fo:external-graphic src="http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg" />
    </fo:block>
    <fo:block xsl:use-attribute-sets="text text_2 text_0 #PAGE_HEADER_ALIGNMENT#">
    <fo:inline xsl:use-attribute-sets="page-header">#PAGE_HEADER#</fo:inline>
    </fo:block>
    </fo:static-content>
    I can access the image through my web browser using the URL, but my log is throwing these errors:
    07/10/31 13:01:18 [WARNING] table-layout=auto is not supported, using fixed!
    07/10/31 13:01:20 [ERROR] Could not load external SVG: http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg<Line 1, Column 50>: XML-20190: (Fatal Error) Whitespace required.
    07/10/31 13:01:20 [ERROR] Error while creating area : No ImageReader for this type of image (http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg)
    07/10/31 13:01:20 [INFO] [2]
    07/10/31 13:01:21 [ERROR] Could not load external SVG: http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg<Line 1, Column 50>: XML-20190: (Fatal Error) Whitespace required.
    07/10/31 13:01:21 [ERROR] Error while creating area : No ImageReader for this type of image (http://epsilon.fastenal.com:7784/i/FastenalLogo.jpg)
    07/10/31 13:01:21 [INFO] Parsing of document complete, stopping renderer
    Could the fo block be in the wrong place in the document? I'm not very familiar with XSL-FO and may have just placed it wrong.
    One other thing I just noticed. The webserver is actually using SSL, which on windows systems results in a pop-up about security. If I change the URL to https using the SSL port, I receive a message about security certificates.
    Thanks,
    Leigh
    Message was edited by:
    ljohnson74

  • How to generate a .pdf output for a BLOB column?

    Hi friends,
    (Forms 6i)
    I have a .pdf into a blob column and I want to show that .pdf as my report output...
    Example-> The report only have this query:
    select myblob_ column
    from mytable
    the column in database has the .pdf ... but when I execute the report, it only appears some information when I put the item to show as Text... But obviously it's not the ofriginal pdf...
    If I try to put as OLE2 doesn't appear either anything and if I try to put it as an Image, it appears a message error.
    Any ideas?
    Thanks.
    Jose.

    Hello,
    How has been "uploaded" the PDF file in the BLOB ?
    Regards

  • How to insert  data into BLOB column  using sql

    Hi all,
    How to insert data into BLOB column directly using sql .
    create  table temp
      a blob,
      b clob);
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
    ERROR at line 1:
    ORA-01465: invalid hex number
    Please help in this.Thanks,
    P Prakash

    see this
    How to store PDF file in BLOB column without using indirect datastore

  • How to view PDF files strored in a BLOB column

    Hi all,
    I want to display a PDF file, stored in a BLOB column, in a form or through a JavaBean.
    But the problem is more complicated then that. I do not want to retrieve the PDF file in the application server that show it through a browser.
    Actually, I do not want users to get the entire file, I just want them to see it or print it.
    I want, in fact, to display a "stream" of bytes through Oracle Forms. Not a file.
    This one, sounded to be a good solution, but actually not. When the file was too big (multiple pages), the application was blocked until the entire file was loaded. And when you try to print it, it wasn't printed right. The advantage of this solution is that it is open-source so we can add methods to connect to the DB, retrieve the content of the BLOB column and displays it without downloading the file.
    Here is a good solution. Really good, files are loaded quickly, the rendering is really good and the file is printed perfectly (as it was printed from Adobe Acrobat). The disadvantage of this solution is that it is not open-source and is really expansive.
    As you can see, both solutions uses PJC.
    So any help, any idea to solve my problem will be highly appreciated.
    Thanks to all of you,
    Amine
    PS : I am using F&R 11gR2

    Not entirely. At least we came to the conclusion it doesn't make (much) sense to block the save option of PDFs if you want to allow printing them
    Anyway; there is of course another possibilty: you could always write your own java bean PDF reader; there are plenty of java PDF libraries available:
    Open Source PDF Libraries in Java
    The easiest way would be to choose one which can open a PDF from a URL and render it; I would retrieve the image via mod_plsql using WPG_DOCLOAD and simply use the PDF library to render the PDF. No tempfiles anyway, and if you don't implement it there is also no save button.
    cheers

Maybe you are looking for

  • Help Regarding Solution Manager Key

    Hi, Experts, Could anyone please generate solution manager key for me. My details are Host name: room C instance number: 02 SID: DXI I would appreciate if anyone help me in this regard ---Ravi

  • Documentation for exporting apex page to Word or PDF

    Hi, Do you know of any examples or documentation for exporting several regions on an APEX page to either a word doc or a pdf? I have tried using the report print functionality but it's not quite robust enough and I can only do one report. Any directi

  • MIRO Layout with the Intended sequence

    Hi All I am introducting my self as Rravindrareddy.P. FICO Consultant. I need your help to meet my client requirement. Thanks in Advance  . I have created New  MIRO layout in T Code SHD0 with the required fields  and deleted the  unwanted fields.( Ma

  • Will not import AC3

    I've seach the forums about this issue and I know there is alot of discussion however I have still not found a specific solution.  I have CS5.5 encore and when importing files that have audio in AC3 format Encore says "The sofware that's used to deco

  • Installing ODAC10202.exe dialog shuts down with no nerror

    Hi, As the subject suggests, I am having a problem with my ODAC installation: I placed the file in c:\installation and double click to expand it. Then I go into the install directory that has been created. I run setup. I select to install Oracle Data