Display Pdf report on Frame using iText library

Hi,
I am able to generate pdf reports using iText library. but i want to display these generated pdf into frame. can u please help for this.
this is web based application. Through servlet i am generating the pdf report using iText library. I am waiting for your reply ....

Does this PDF file absolutely need to be displayed within a JFrame? You say you are generating this document on the server side, so if this is a web application, what I might do is place the generated document on directory accessible through http, then on the client browser side open a pop-up browser window with a URL to the PDF document.
Most browsers have a PDF viewer plugin of some kind.
If this is a swing application then you can do the same thing but instead of redirecting the browser to the PDF file you can use iText to convert the PDF document to an RTF document and use an RTFEditorKit within a JEditorPane to display the same document in RTF format.

Similar Messages

  • Creating PDF file in XI using iText

    Hi all,
    I am trying to create a PDF file in XI using itext. The PDF file is getting created in my target ftp server but I am not able to open the PDF. It is throwing the below error while opening.
    "Adobe Reader could not open the sample.pdf because it is either not a supported file or because the file has been damaged(for example,it was sent as an e mail attachment and wasn't correctly decoded)"
    I am using the below code in my udf
    String filename= "Sample.pdf";
    try
    Document document= new Document();
    PdfWriter pdfwriter=PdfWriter.getInstance(document,new FileOutputStream(filename));
    document.open();
    document.add(new Paragraph("Hi How are you?"));
    document.close();
    DynamicConfiguration conf = (DynamicConfiguration) container
           .getTransformationParameters()
           .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    conf.put(key,filename);
    catch(Exception e)
    return "";
    Kindly let me know if you have any information on this.
    With Regards
    jaisu.
    Edited by: jaisu118 on Feb 12, 2010 8:04 AM

    hi,
    I had used custom adapter module for creating the PDF file.
    you have to use java mapping if you want to create pdf without using adapter module.
    You need to import iText library available at http://itextpdf.com/.
    How to use external jar files ??
    External Jar files in UDF
    code may look like this:
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.Reader;
    //1. AbstractTransformation class is imported.
    // The associated jar file is: com.sap.xpi.ib.mapping.lib.jar
    import com.sap.aii.mapping.api.AbstractTransformation;
    import  com.sap.aii.mapping.api.DynamicConfiguration;
    import com.sap.aii.mapping.api.DynamicConfigurationKey;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    import com.sap.aii.mapping.api.InputHeader;
    public class xyz extends AbstractTransformation {
    public void transform(TransformationInput inp, TransformationOutput out) throws StreamTransformationException {
         getTrace().addInfo("JAVA Mapping Called");
                         InputStream inData = inp.getInputPayload().getInputStream();
                        // pdf conversion code
                        out.getOutputPayload().getOutputStream().write(outData.getBytes("UTF-8"));
    check http://help.sap.com/javadocs/pi/SP3/xpi/index.html for java mapping api.
    Thanks.

  • Extract images using itext library (Urgent)

    Hi All,
    Please send some sample example of extracting embedded images using iText library.
    Thank in advance.
    - Ganesh

    @Avinash – I'd use InDesign (the re-opened IDML file) and some ExtendScript scripting for that task.
    You have to distinguish between three basic data types:
    1. Pixel only
    2. Vector only
    3. Mixed pixels and vector
    Pixel only: could stem from a variety of source files: from PSD, TIFF, JPEG, PNG, EPS…
    Vector only: EPS, WMF, PDF
    Mixed ones: EPS, PDF, PhotoShop (//EDIT: Not to forget PSD!!)
    It depends on your InDesign version which type of file you can write (export):
    PDF, EPS, JPEG, PNG*
    So, for an unclear situation (the nature of the placed file) I always would chose PDF as export format with transparency intact: PDF/X-4.
    And proceed on with the exported PDFs. You could parse them to PhotoShop writing pure pixel formats if you want.
    You could also look for Adobe Illustrator meta data and try to open it in Adobe Illustrator.
    Here an example for what can be done with ExtendScript and pasted or embedded images by Peter Kahrel:
    Peter Kahrel
    Write pasted and embedded images to disk
    http://www.kahrel.plus.com/indesign/unembed_images.html
    However, this script is missing PDFs as export format.
    Layered embedded PhotoShop or Adobe Illustrator files would also be a very special case that should be treated separately.
    Color Management in these cases could be a problem too.
    From pure IDML, I see no chance…
    (but maybe someone else)
    Uwe
    Message was edited by: Laubender

  • Displaying pdf report in pop page by command button.

    Hi
    I am jdev 10.1.3.3 .I am displaying an pdf report on click of command button like this.
    FacesContext.getCurrentInstance().getExternalContext().redirect("http://www.acme.com/someCustomPath/myFantasticReport.pdf");
    But problem is this.It is displaying on same window.I want to display it in new window or pop window..Probelm is that i am redirecting the page.
    Is there any other way to display in new window.Please help
    any help would be helpful

    Hi,
    check this: http://thepeninsulasedge.com/frank_nimphius/2007/09/11/adf-faces-showing-reports/
    Frank

  • Problem in displaying PDF report

    Environment : WEB
    AS : Oracle 9i As
    Dev : Oracle 9i Developer Suite
    Db : Oracle 9i DB
    when we call a report(pdf format) from form, It opens up the acrobat reader then,it gives the following error " There was an Error Processing a Page. There was a problem in Reading this document(135)"
    What is the reason for this error? how can solve it?

    our setting with destype=cache, desformat=pdf, paramform=NO.
    report job status returns success. the call web.show_document() uses jobid to display the output. It launchs the pdf program, and then browser returns "PDF error 135" error.
    the actual cache is created in ora_home\midtier\reports\cache\ as #######.pdf, when manually opening it, it returns "PDF error 135".
    Usually when this issue occur, jobs queue are growing then shortly after, rweng will crash. Only way to recover is by restarting the server box.
    any ideas? Thank you in advance!
    Kan

  • Displaying pdf in browser when using Windows 7 Beta & AR 9

    Early indications are that "Adobe Air" and/or "Acrobat.com" are breaking the display in browser function in Windows 7 Beta when using Adobe Reader 9.
    On a fresh install of Windows 7 Beta, I installed Adobe Reader 9, and as everyone is finding out, you cannot display a pdf in a browser window. Doesn't matter which browser either. IE8, Opera 10a, Mozilla SeaMonkey 1.1.14 had the same result for me. The only workable option was to have the pdf open in a separate window of Adobe Reader itself. Oddly though, on rare occasions I could get a pdf to display in a browser window, but 95% of the time it would not work.
    On another fresh install of Windows 7 Beta, I installed Adobe Reader 9. After installation I opened Adobe Reader and accepted the license agreement, then closed Adobe Reader. Next I uninstalled "Acrobat.com", then uninstalled "Adobe Air" using Programs and Features in Control Panel. So far, I have not had any problem downloading and viewing pdf's in a browser window. Tested with IE8 and Opera 10a. Note that I did not run compatibility mode on Adobe Reader.

    Hi,
    I (April) apologize I have been OOO and have not been able to respond to your replies.  
    Let’s start over. 
    We have an issue where help topics do not display when selected in the TOC or when a link to the topic is clicked within another internal topic. It is in a continous loop in the browser (flickering like it is trying to load). If you right-click on the topic it displays (we are currently using this as the work-around).
    We use Windows 7, IE9 and RH10 for all our projects. (Recently upgraded from RH8 to RH10)
    Turns out the problem is not isolated. I have run across it in at least one other project, which leads me to think it also occurs in others.
    "Does this only occur when the help is called from your software? Is it OK if you double click the start page?"
              No. I it ALSO occurs when launched from the start page. 
    Have you tried deleting the CPD file and reopening Rh and the project?
              Yes, without success.
    Are you using any redirects?    
              Per (Adrienne), “I am not using any redirects. I encounter this issue only in IE. If I paste the .htm into a Firefox browser, the help displays as it should.” 
              I will add that the project also displays incorrectly in Google Chrome.
    Thanks  April

  • Pdf report viewing problem using Sun appserver9

    i want to generate a report from my web application.if i use appserver8.2 it can view report in pdf ,html and csv format.but when use appserver 9 it cant show the report in pdf format.message is shown as File is not a valid postscript document.i am using fedora core 4 and mozilla firefox.pls help someone

    Hi user;
    Please check below thread and related docs,suggestion
    Re: Print pdf direct from concurrent manager
    Re: How to print PDF file with hp-ux 11.31 on itanium
    Hope it helps
    Regard
    Helios

  • Stack overflow using itext library

    Hi,
    I tried to merge 6-7 PDF files using library itext1.4.1.jar.
    PDF files are heavy say 5mb each.
    It throws me stack overflow error.
    Please help if anybody faced similar problem.
    Ashish.

    It throws me stack overflow error.Post the full stacktrace, please.

  • Pdf print and view using swing

    hello
    i am created one pdf file from original pdf file with data using itext library,but now my problem is how can view this file and print this pdf file using swing printing api

    but how to print?
    Note: Just because the PDF DocFlavor exists doesn't mean you can use it to print a PDF file. When you lookup the PrintService for the PDF flavor,it will report unsupported flavor. That means there is no print service for the flavor. Sun doesn't provide one for PDF files. To the best of my knowledge,nobody else makes one available either. Until such a time as someone does,you can't print PDF files using the new Print Service API.
    ??? is there another way to print a pdf-file directly from filesystem without using the command line like:
    C:\..\Acrobat 5.0\Reader>acrord32.exe/t test.pdf
    thanks for replys
    mfg

  • Can't display pdf's using IE 10

    This issue I have had for several months even using IE 9.  I can display PDF's just fine using Firefox.
    I have read and read and have exhausted all options...I think.
    I have the latest Reader and also have X Pro installed, using WIN 7, 64 BIT
    When I click on a PDF document on any webpage all I get is a circle with a line through it on the top left corner of the screen when a new window opens up.
    Any help is greatly appreciated!

    Could you please check the following settings/preferences:
    1.Launch Reader/Acrobat (specifically the one which has its plugin used for brwoser-  you better change the preferences for both).
    2.Goto Edit->Preferences-> Internet (in categories pane)
    Check whether Display PDF in browser is enabled; if not, enable it- and then retry.

  • I need to configure Acrobat to display PDF files in Safari, but I have a lot of troubles to do it.I have OX S yosemite, I unistalled adobe acrobat, I closed safary and I installed the new version of adobe acrobat.

    Dear everyone
    I need to configure Acrobat to display PDF files in Safari, but I have a lot of troubles to do it.
    I read a european commission document explaining that
    http://ec.europa.eu/research/participants/data/support/sep_usermanual.pdf
    If Safari does not display pdf forms in the browser window, uninstall all older versions of Adobe Reader and download the most recent one. First close Safari and then install Reader. Launch Safari and you ought to be able to open the pdf files inside the Safari window. If you install Adobe Reader 10.1.x without first closing Safari, Safari will not display the pdf file inside its browser window until it is re-launched. For further help, please see http://helpx.adobe.com/acrobat/kb/troubleshoot-safari-plug-acrobat-x.html
    I have OX S yosemite, I unistalled adobe acrobat, I closed safary and I installed the new version of adobe acrobat
    but when I open a web page that I need to allow me to display and modify PDF files it is not working.
    I checked the following web page
    Troubleshoot Safari plug-in | Acrobat X, Reader X
    that is recommending the following:
    The AdobePDFViewer plug-in is used to display PDF files in Safari using Acrobat and Reader.
    This plug-in is installed as part of the Acrobat X or Reader X installation. The location of this plug-in is:
    /Library/Internet Plug-ins/AdobePDFViewer.plugin
    but after the new installation with this folder is completely empty and I am still
    unable to open these pdf.
    Does anybody knows anything else I can do?
    Best regards
    Ramon

    Moving this discussion to the Adobe Reader forum.

  • Error in displaying hierachry report with TableView and Tableiterator

    Hello,
    I tried to create a BSP as shown in this tutorial:
    /people/vijaybabu.dudla/blog/2008/08/04/display-hierarchy-report-in-bsp-using-tableview-and-tableview-iterator
    When starting the BSP I get an error that a field symbol is not assigned in the method get_column_name.
    When debugging the method get_column_name I can see that row_ref is initial. So the field symbols <row> and <col> are not assigned to any values, which causes the error some lines below.
    METHOD get_column_value .
    *-To get the Column values which is used in the Interator
      FIELD-SYMBOLS: <row> TYPE ANY, <col> TYPE ANY, <cur> TYPE ANY.
      ASSIGN row_ref->* TO <row>.
      ASSIGN COMPONENT column_name OF STRUCTURE <row> TO <col>.
      DATA tempchar(240) TYPE c.
      IF currency IS NOT INITIAL.
        ASSIGN COMPONENT currency OF STRUCTURE <row> TO <cur>.
        WRITE <col> CURRENCY <cur> TO tempchar.
        MOVE tempchar TO column_value.
        CONCATENATE column_value ` ` <cur> INTO column_value.
      ELSE.
        WRITE <col> TO tempchar.
        MOVE tempchar TO column_value.
      ENDIF.
      CONDENSE column_value.
    ENDMETHOD.
    Any help?
    Thank you

    Hi Patrick,
    Thank you for the answer.
    Unfortunately there is still the error with the unassigned field symbol after implementing the render_row_start method.
    Any help?
    Edit: It works now. There was an error with a wrong variable name (stupig mistake.)
    Thanks for the help!
    Edited by: Robert Karlovic on Mar 5, 2009 10:29 AM

  • Crystal report in JSP using activeX viewer

    Hi,I'm trying to integrate JSP and crystal report.
    can you give me a sample code to display crystal report in JSP using activeX viewer(not pure HTML)
    I'm using crystal report 9,there are ASP sample come with CR9,but no JSP.also I don't want use Crystal Enterprise9 even I know the URL reporting may be the eaier way.

    Hi,I'm trying to integrate JSP and crystal report.
    can you give me a sample code to display crystal
    report in JSP using activeX viewer(not pure HTML)
    I'm using crystal report 9,there are ASP sample come
    with CR9,but no JSP.also I don't want use Crystal
    Enterprise9 even I know the URL reporting may be the
    eaier way.Hi, did u manage to get the ActiveX Viewer up with JSP? I'm also trying to do the same thing. If you could, pls kindly email me the basic source codes to [email protected]? Thanks

  • Urgent: Issue while displaying the PDF Reports Using XDO Common region

    Hi all,
    In our product code we are trying to display the PDF Reports, using the xdo common region.
    Previously we were writing the pdf reports direclty onto the response direclty.
    This displays the report onto the browser but if navigate throw browser back button, it doesn't displays the report as the response stream is empty while navigating through back button.
    So to solve this issue, i tried to write the report using the OAHTMLWebBean and xdo common region. Here is the code:
    ByteArrayOutputStream xdoOutput = new ByteArrayOutputStream();
    XDOUtility.retrieveReport(xdoOutput,
    parameters,
    prop,
    appMod
    BlobDomain bxdoOutput = new BlobDomain();
    bxdoOutput.setBytes(xdoOutput.toByteArray());
    String redirectURL = DocumentHelper.getOutputURL(pageContext,
    bxdoOutput,
    "Report",
    "PDF");
    OAHTMLWebBean outRegion = (OAHTMLWebBean)createWebBean (pageContext, OAWebBeanConstants.HTML_WEB_BEAN, null, "IFRAME");
    outRegion.setHTMLAttributeValue("src", redirectURL);
    outRegion.setHTMLAttributeValue("width", "100%");
    outRegion.setHTMLAttributeValue("height", "100%");
    outRegion.setHTMLAttributeValue("title","Report");
    outRegion.setHTMLAttributeValue("name","Report");
    pageContext.getPageLayoutBean().addIndexedChild(outRegion);
    This successfully displays the report in the XDO Common region. But now the issue is that there are hyperlinks in the Report displayed where from where the user can navigate to other detail pages.
    When we click on these links, a new session starts in the xdo common region.
    Is it possible that when the user click the links in the report displayed, instead of starting a new session in the xdo region, the detail pages is displayed with in the older session.
    Regards
    Sandeep

    Hi all,
    In our product code we are trying to display the PDF Reports, using the xdo common region.
    Previously we were writing the pdf reports direclty onto the response direclty.
    This displays the report onto the browser but if navigate throw browser back button, it doesn't displays the report as the response stream is empty while navigating through back button.
    So to solve this issue, i tried to write the report using the OAHTMLWebBean and xdo common region. Here is the code:
    ByteArrayOutputStream xdoOutput = new ByteArrayOutputStream();
    XDOUtility.retrieveReport(xdoOutput,
    parameters,
    prop,
    appMod
    BlobDomain bxdoOutput = new BlobDomain();
    bxdoOutput.setBytes(xdoOutput.toByteArray());
    String redirectURL = DocumentHelper.getOutputURL(pageContext,
    bxdoOutput,
    "Report",
    "PDF");
    OAHTMLWebBean outRegion = (OAHTMLWebBean)createWebBean (pageContext, OAWebBeanConstants.HTML_WEB_BEAN, null, "IFRAME");
    outRegion.setHTMLAttributeValue("src", redirectURL);
    outRegion.setHTMLAttributeValue("width", "100%");
    outRegion.setHTMLAttributeValue("height", "100%");
    outRegion.setHTMLAttributeValue("title","Report");
    outRegion.setHTMLAttributeValue("name","Report");
    pageContext.getPageLayoutBean().addIndexedChild(outRegion);
    This successfully displays the report in the XDO Common region. But now the issue is that there are hyperlinks in the Report displayed where from where the user can navigate to other detail pages.
    When we click on these links, a new session starts in the xdo common region.
    Is it possible that when the user click the links in the report displayed, instead of starting a new session in the xdo region, the detail pages is displayed with in the older session.
    Regards
    Sandeep

  • Display PDF file in the Apex query report using HTML Expression

    Hi Folks,
    I have PDFs stored in BLOB columns along with FILE_ID column in the database.
    I want to display these to the APEX user on the page at runtime.
    I have created a SQL Query report page to display FILE_ID column.
    I am using HTML Expression property of the FILE_ID column to pull the image from the table using PROC_DISPLAY_DOCUMENT procedure.
    I typed folowing code int the HTML Expression text area of the FILE_ID column of the report page :
    <img src="#OWNER#.proc_display_document?p_id=#file_id#"/>
    I am using following Procedure code:
    create or replace procedure "PROC_DISPLAY_DOCUMENT"(p_id number) as
    s_mime_type varchar2(48);
    n_length number;
    s_filename varchar2(400);
    lob_image blob;
    Begin
    select MIME_TYPE,dbms_lob.getlength(blob_content),file_name,blob_content
    into s_mime_type,n_length,s_filename,lob_image
    from tbl_upload_file
    where file_id = p_id;
    owa_util.mime_header(nvl(s_mime_type, 'application/octet' ),false);
    --set the size so the browser knows how much it will be downloading
    htp.p( 'content-length: '|| n_length );
    --The file name will be used by the browser if the users does a "save as" 
    htp.p( 'content-Disposition: filename="' || s_filename ||'"');
    owa_util.http_header_close;
    --Download the BLOB
    wpg_docload.download_file( lob_image );
    exception
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-202121,'Record matching screenfield filename not found, PROC_DISPLAY_DOCUMENT.');      
    end;
    --This is very Important
    --grant execute on PROC_DISPLAY_DOCUMENT to public;
    This code does not work and report does not display PDF image.
    Any help to troubleshoot this code will be appreciated.
    Thank you in advance.
    Jaya

    Hi Dimitri,
    I hope you can see HTML Expression code now. Thank You for responding.
    I have PDFs stored in BLOB columns along with FILE_ID column in the database.
    I want to display these to the APEX user on the page at runtime.
    I have created a SQL Query report page to display FILE_ID column.
    I am using HTML Expression property of the FILE_ID column to pull the image from the table using PROC_DISPLAY_DOCUMENT procedure.
    I typed folowing code int the HTML Expression text area of the FILE_ID column of the report page :
    [!--  img src="#OWNER#.proc_display_document?p_id=#file_id#" ]
    I am using following Procedure code:
    create or replace procedure "PROC_DISPLAY_DOCUMENT"(p_id number) **
    mimetype varchar2(48);
    n_length number;
    s_filename varchar2(400);
    lob_image blob;
    Begin
    select MIME_TYPE,dbms_lob.getlength(blob_content),file_name,blob_content
    into s_mime_type,n_length,s_filename,lob_image
    from tbl_upload_file
    where file_id = p_id;
    owa_util.mime_header(nvl(s_mime_type, 'application/octet' ),false);
    --set the size so the browser knows how much it will be downloading
    htp.p( 'content-length: '|| n_length );
    --The file name will be used by the browser if the users does a "save as"
    htp.p( 'content-Disposition: filename="' || s_filename ||'"');
    owa_util.http_header_close;
    --Download the BLOB
    wpg_docload.download_file( lob_image );
    exception
    WHEN NO_DATA_FOUND THEN
    RAISE_APPLICATION_ERROR(-202121,'Record matching screenfield filename not found, PROC_DISPLAY_DOCUMENT.');
    end;
    --This is very Important
    --grant execute on PROC_DISPLAY_DOCUMENT to public;
    This code does not work and report does not display PDF image.
    Any help to troubleshoot this code will be appreciated.
    Thank you in advance.
    Jaya

Maybe you are looking for

  • How to find out the coordinates of rotated textframe

    Hi All, With the help of (idml) itemtransform horizontal / vertical distances and path point arrays, I can find out the coordinates of text frame (x1,y1), (x2,y2), (x3,y3), (x4,y4). If the textframe is rotated then item transform values are getting c

  • Problem in Receiver FCC

    Hi Experts,                    We need to do a file content conversion in the Receiver File Adapter for a fixed length file, format of which is like: MT_Message   Shipment..........1..1      field1      field2      field3 Order.................1..1  

  • Oracle 10g R2 Database Redo Log Files

    I had 3 redo log files, each of size 50 MB. i added 3 more redo log files, each of size 250 MB. Database is running in archive mode, files are generating with different sizes like 44 MB and 240 MB, i need to know is this harm for database or not? to

  • How to find reason for system crash?

    Hello, I have a test system running in VirtualBox environment and its crashing every now and then, sometimes two times a day but sometimes it lasts for 3 days before crash happens. system info root>cat /etc/*release* Solaris 10 10/09 s10x_u8wos_08a X

  • Objects I put in dock won't stay there

    I keep placing various app icons on the dock and the intermittently disappear. I'm guessing I need to change the privileges of a specific file but I don't know which one. Anyone know how to change a setting so the items I place on the dock remain the