How to show a PDF with a JSF jsp.

Hello,
I want to show a PDF in a JSF jsp.
I'm a newbie with this, and don't know where to look for information about that.
Any example on the web ?
Thanks in advance

I think you will need to eventually get it to the HTML <object> tag anyway.
<OBJECT data="yourPDFhere.pdf" type="????""/>
and to get the byte[] to the client you may need to make a Servlet to respond to *.pdf requests and feed the correct session 'in memory' pdf out the stream.
Here is an example from some svg 'in memory' per session I was testing:
* SessionServlet.java
* Created on June 3, 2004, 12:09 AM
package com.hypernex.xml.svg;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
* @author  Roger I Martin, PhD
* @version
public class SessionServlet extends HttpServlet
    /** Initializes the servlet.
    public void init(ServletConfig config) throws ServletException
        super.init(config);
    /** Destroys the servlet.
    public void destroy()
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
        ServletContext context=getServletContext();
        java.util.Enumeration e=context.getServlets();
        while(e.hasMoreElements())
            System.out.println("servlets \t"+e.nextElement());
        /*e=context.getAttributeNames();
        while(e.hasMoreElements())
            System.out.println("AttributeNames \t"+e.nextElement());
        e=request.getParameterNames();
        while(e.hasMoreElements())
            System.out.println("ParameterNames \t"+e.nextElement());
        System.out.println("getContextPath "+request.getContextPath());
        System.out.println("getRequestURI"+request.getRequestURI());
        response.setContentType("text/xml+svg");
        PrintWriter out = response.getWriter();
        HttpSession httpSession=request.getSession();
        System.out.println("getQueryString"+httpSession);
        if(httpSession!=null && request.getRequestURI().endsWith("wafermap.svg"))
            /*e=httpSession.getAttributeNames();
            while(e.hasMoreElements())
                System.out.println("httpSession AttributeNames \t"+e.nextElement());
            SVGProducer svgProducer=(SVGProducer)httpSession.getAttribute("waferMap");
            out.print(svgProducer.getSVGView());
        else if(httpSession!=null && request.getRequestURI().endsWith("hardware.svg"))
            SVGProducer svgProducer=(SVGProducer)httpSession.getAttribute("hardwareBean");
            out.print(svgProducer.getSVGView());
        else if(httpSession!=null && request.getRequestURI().endsWith("geometry.svg"))
            SVGProducer svgProducer=(SVGProducer)httpSession.getAttribute("geometryBean");
            out.print(svgProducer.getSVGView());
        else
            try
                java.io.BufferedReader br=new java.io.BufferedReader(new java.io.FileReader("./webapps"+request.getRequestURI()));
                String line=null;
                while((line=br.readLine())!=null)
                    out.println(line);
                br.close();
            catch(java.io.IOException ioe)
                System.out.println("ioe:"+ioe.getMessage());
        out.close();
    /** Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
        processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
        processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo()
        return "SVG graphics handler";
}

Similar Messages

  • How can I read pdf with ebook reader on JounE touch

    How can I read pdf with ebook reader and where could I put the pdf in Journe

    Hi there
    You said that you want to read pdf with ebook reader .
    For me ,i usually read the pdf files using another pdf reader which supports to read the pdf files directly.
    And i am now just using their free trial.
    You can also have a try.
    +Message was edited: Advert has been removed+

  • How to show catalog items with Approval Status:Pending in a Content Search Webpart

    How to show catalog items with Approval Status:Pending in a Content Search Webpart using cross site publishing. Thanks in advance.

    I don't think you're going to be able to. Usually Approval Status is used in conjunction with Major/Minor versioning and while Approval Status is pending the item is usually a draft.
    As a result the search crawler should not be able to see the draft items as it would not have the necessary rights to do so. (Good practice ensures that the Search Crawler has only read access and is not an elevated account for this reason)
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • How to show the pdf file into the UIWebView from iphone documents directory?

    Hi ,
         I am working on web services right now I am getting string into base64 format. After decoding that string into NSData i am saving that data as a pdf into Document directory of iphone. Now the problem is that when I want to show the pdf into UIwebView then it is showing blank page. But when I am checking into /Users/pareshkarnawat/Library/Application Support/iPhone Simulator/4.3.2/Applications/ the pdf file is correctly generated and working fine when I ope it.
       How to show that pdf file into UIwebview ? or is there any alernative for this.
    Any ideas on how I can go about this? I have looked at a few posts and still can't seem to figure it out.
    Any idea's appreciated, thanks

    The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The thing is that data has the correct length, in bytes, for the PDF I am trying to display, and I also get the pdf file in Library/Application Support/iPhone Simulator/4.3.2/Applications/ Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?

  • How to create a pdf with the correct size?

    Hi there
    How do I create a pdf with the correct size? I created several albums and ordered them. Now I want to backup the album and I know how to create a pdf, but when I choose A5 it's to big, when I create my own size it's not the size it should be. The original (made with iphoto) is a small size album 200x150mm. But when I create my own size (200x150) it shows some white borders.
    Does anybody have some tips ore workarounds?
    Yuri
    Imac
    Iphoto 11 (9.4.2)

    Books are designed for and printed on 8.5 x 11 inch stock, US Letter size.  You shouldn't have to select any size.  While viewing the All Pages mode in the book Control-Click on the page and select Save Book as PDF from the contextual menu. 
    That will create a PDF that iPhoto uses to upload and print.  Not all pages will be the same size as the dust jacket will be present in it's full size, 32.8 inches x 8.91 inches:
    If you want a PDF that's designed for your own printing the type Command+P while viewing the All Pages window.  In the first print window click on the PDF button.  It will present you with a contextual menu where you should select Save as PDF.  That will give you an 8.5 x 11 PDF file with all pages the same size.
    OT

  • PSE 8: How to create a pdf with several pages?

    I want to deliver DINA4-Sheets (thats bacic European standard size of a sheet of paper for let's say writing an official letter) to print out in a copy-shop. Now the copy-shop-owner says, for him it will be much easier if I hand in my 10-20 pages in one pdf-file with 10-20 pages and not 10-20 single-paged pdf-files, cause then he only needs to do the colour-routines and adjustings once and not many times. Now there is the problem, in Elements 8 there is the option to save a psd as a pdf-file, but I don't know how to add the other files and make a pdf with more pages than just one. May be I need to do that with Scribus, a freeware prog.

    Hello Barbara!
    Your answer just proved extremely helpful. It worked that way. I first created a pse-file in the right document size. Then with copy and paste I imported the first page and flattened it to one layer. Then I chose to create the second pse-page, that shows automatically in the menue then with the pse-file open. Into the second page again with copy and paste I imported the second single sheet and flattened the second page too to one layer and so on. That way it works. Finally I first save in the pse-file and then save the whole thing as pdf.
    Very easy to do. Thanks a lot!

  • How to show a pdf file in bi publisher report

    Hi All,
    We need to show a pdf file as report which was saved in a given location. How to call that pdf file as report. We need to give a hyperlink in the report and when we click on the report the pdf file should be displayed.
    When we open a report, there will be just hyperlinks to call serveral reports. When we click on each link , one should call a pdf saved in a particular location.
    Thanks.

    In Word, if you have set the borders on then you should see them in the output. In Word it has a setting to let you see 'gridlines' even if they are not set ie you have turned the borders off. Highlight the table and set all the borders on and re-try. If that fails, try building the table from scratch and copy the cell contents across to the new table
    Tim

  • How to print a PDF with multimedia content?

    I have a 127 page PDF with flash files and other multimedia embedded. How do  go about printing this to a laser printer?

    Thank you Michael
    My problem is, I need to print the document with the mm items.  I work 
    in a print & copy shop, we must deal with whatever the customers send 
    us.
    I actually stumbled around and found I could do it with the MultiMedia 
    Flash Tool, editing the poster options. It's a tedious process though, 
    and I'd like to find a way to set this for the whole PDF file at once.
    If you know how to do this I'd appreciate the info.
    Thanks again,
    Mark

  • Showing a PDF with InteractiveForm and IFrame components

    Dear Experts,
    For quite some time we were having several issues while showing PDF Files in WebDynpro Java Components because of different versions of Adobe Readers and mainly because of browsers. Finally I have read about the option to show PDFs using IFrame.
    byte[] PDFFormContent = bytes;
    IWDResource resource = WDResourceFactory.createCachedResource(PDFFormContent, pdffile.getName(),WDWebResourceType.PDF);
    Now this is working for me with Google Chrome, Firefox and IE without a problem. But with different pc clients of my colleagues PDF files are forced to download,when the application is called, instead of showing the PDF file in an IFrame.
    Which setting is deciding to whether download the PDF or showing it embedded? Is there any way to prevent this grammatically?
    Thanks and Regards,
    Koray

    If you are allowed to, you could check Adobe settings on client side.
    Take a look at this:
    See also the official Adobe guide Acrobat Help | Display PDF in browser | Acrobat, Reader XI
    Hope this helps.
    Regards,
    Tobias

  • Urgent, SOS for help: How to show the pdf file name at the right bottow of the page?

    I want to show the pdf file name at the right bottow of the page for filing purpose, anybody knows anything?
    I know it can be showed at the left bottom through adobe printer, but i need it to be at the right bottom.
    thanks.

    The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The thing is that data has the correct length, in bytes, for the PDF I am trying to display, and I also get the pdf file in Library/Application Support/iPhone Simulator/4.3.2/Applications/ Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?

  • How to open a pdf with a ".exe" extension?

    Hi everyone,
    I am new. Someone just sent me a document they created in Acrobat 9 pro. They say it is a password protected pdf. When I click open or download, it changes from 1 KB to 28 bytes and displays a message that the content has been deleted. I would really appreciate any insights!
    In case it helps, I am using Windows 7 and have Acrobat XI Pro. Thanks.

    If it was a PDF with a .exe extension I suspect you have just been injected with Virsus, Worm, Trogan Horse or some other malware.  A PDF if it’s a true PDF will only have pdf extension.  When some one says it’s a Pdf but say it will be sent as exe file don't download it. Or if itd ownloaded don't open it trash it immediately.

  • How to "Print to PDF" with property "Signing: Allowed"

    Print to PDF generates a file with the security document property "Signing: Not Allowed". These Properties are only visible in Acrobar reader -> File -> Properties; you can't see these in Preview.
    Is there a way to change Mac OS X Print to PDF, that it generats PDFs with "Signing Allowed"?

    Thomac:
    After further review I discovered that it isn't the PDFs you are creating that has the problem, it is the limitations of Adobe Acrobat Reader to perform the ability to do the functions of Document Assembly, Commenting, Signing and Create Templates. If you had Acrobat Professional and opened your PDFs and checked the properties, you would discover that all these would be allowed.
    Initially, I was looking at my test files with Acrobat Professional. But, when I opened the same PDF with Reader on a different machine, I was getting the same summary as well.
    Adobe Reader is just that: a READER.
    You can feel safe that your PDFs allow signing.

  • How to show timestamp along with date in LOV dropdown

    Hi,
    We have a requirement to show timestamp along with date as a display column in a LOV drop down. Type of the date column in VVO is set to timestamp. But still it is showing only date in the UI.
    But it is showing timestamp when we run it through AM. Is there any thing in to do in addition to display it in UI? Or it is not feasible? Please suggest me on this issue.
    Thanks in advance.
    Thanks,
    Santhosh

    The date format displayed in UI depends on applcore preference set for current user, try changing date format set for current user to include time along with date.

  • How to create multipage PDF with PS?

    I have a 6 pdf pages, and need to create a single pdf with all 6 pages. PS Help states that can create multi page pdf using Generic PDF Files, “Created using the Photoshop Save As command, with Preserve Photoshop Editing Capabilities deselected in the General section of the Save PDF dialog box.” I did that but never found way to select/choose the 6 generic pdf files I created by deselecting Perserve Photoshop Editing Capabilities.
    Is there a way in PS to create a multi-page pdf?

    As of CS4, you need to do it in Bridge.

  • How to master good design with EJB and JSP?

    I use JSP to calling EJB. But the .jsp file is complex and it's difficult to maintain...I just want to work higher efficent with EJB,JSP and JavaBean. I want to know is there a good design with EJB and JSP? and is there any good material about MVC for EJB,JSP and JavaBean?

    You should read the J2EE blueprint available on this website. Better download the PDF, and print it for yourself so you can read it anytime.

Maybe you are looking for

  • WSUS service failure and uninstall error 0x80070643

    Hello I recently had a drive fail in a RAID 1 array on a Windows Server 2008 Standard SP2 domain controller. The drive was replaced and the array successfully rebuilt the drive. Our domain comprises a Win2k8 DC (which WSUS is installed on), a W2k3 DC

  • Requires Ratio based on product

    Hi every one my oracle version 10g we have three tables required Buy_Sell_Ratio. table 1 is trade, table 2 is currency, table 3 is product Trade as (select 1 trade_id, 110 trade_size, to_date('01/02/11',' dd/mm/yy') trade_date, ’AA’ source from dual

  • HT201250 stop time machine deleting back ups

    Hello, I've just started using time machine, and I don't want it to delete my old backups when full - at least not without asking me first. is there any way to do this?

  • Is UCertify any good for exam 1Z0-007?

    Hi, I am thiking about buying UCertify practise questions for exam 1Z0-007, i am wondering if anyone has used it in the past and how good is their product? I can't afford Transcender prep material, the other option is SelfTest but they provide money

  • Updating iPhones on public computers

    I recently updated my iPhone on a public computer.  Thinking about it now, I'm worried the update may have left unwanted personal data on the public computer.  Is this possible?  What type of data could a backup expose?