Is it possible to display PDF file as a h:graphicImage?

I am using a servlet to convert my PDF file into bytearray stream and write the content to reponse as below
String contentType = URLConnection.guessContentTypeFromName(pdfFileName);
BufferedInputStream input = null;
BufferedOutputStream output = null;
try {
input = new BufferedInputStream(new FileInputStream(imageFile));
int contentLength = input.available();
response.reset();
response.setContentLength(contentLength);
response.setContentType(contentType);
response.setHeader(
"Content-disposition", "inline; filename=\"" + pdfFileName + "\"");
output = new BufferedOutputStream(response.getOutputStream());
while (contentLength-- > 0) {
output.write(input.read());
output.flush();
And in my JSF i am using
<h:graphicImage value="/pdfRenderer" id="pdf" />
But i am getting a unnown image shown in the rendered page.

Hi,
pon_jsf, have you succedded to display the pdf file with <h:graphicImage>
Because i have also same requirement. i also want to display the pdf file with <h:graphicImage>
Basically i want to print the pdf file with print dialog box but i dont know print dialog not displaying with mycode. so i have trying another way to display the pdf file
I want to print the jsp page directely with calling javascript function window.print() on onload so that i will get print dialog.
so i need that pdf file must display in my jsf page.
with code
<h:panelGrid>
<h:graphicImage url="#{barcode.pdfFilePath}"/>
</h:panelGrid>
but when i am running it was not displaying the pdf content in my jsf page.
Thanks
Indira.

Similar Messages

  • Preview displays .pdf files incorrectly... really really incorrectly.

    Since yesterday I have been having trouble with Preview and the way it has been displaying .pdf files.
    Initially I opened a .pdf file, and it was displayed as a large mass of random characters... tamil, hindi, arabic, chinese, and so on. Each character inside its own little box, and with all the boxes overlapping to a lesser or greater extent.
    I closed the pdf and reopened it to find that it displayed normally.
    Today, I opened preview to find it displaying my documents as blank pages. Then pages with small spots on the them in apparently random places, and then with some text there, and some gone, and with the amorphous mass of random characters again, and then it finally opened the file normally.
    I was wondering what couldd possibly have caused such strange behaviour, and what the best way to trouble shoot it might be?
    The only thing that I have done to my mac in the last few days is run the little utility 'Maintenance', but all I did was repair permissions, which I can't imagine causing this kind of insanity.
    Please help! I have homework to do!

    I know, restarting is fabulous isn't it? Wish my PC laptop was fixed so easily.
    Unfortunately I have restarted, and it did no good.
    The files all display correctly once they have been opened enough times to start displaying correctly, but as soon as I restart or logout/login it all starts over again.
    I have never seen anything like it.
    At first I thought that maybe it as just a selection of files, but it appears to be preview because it happens in any file I try to open until I get one to open correctly, and then they all display correctly.
    I am a Mac newbie... but on my PC I would reinstall the offending component. Is that
    a. Possible
    b. Necessary
    Thanks for replying...
    - Wren

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

  • Does anyone know why after upgrading to Mavericks, Safari will not display PDF files, is there a solution?

    I cannot get Safari to display PDF files, it shows a blank screen with the comment that Safri has blocked PDF, however when you unblock it still does not show the PDF, I have had to rely on Firefox for this, which I find not too good. Any help very much appreciated.

    Update to 10.9.1
    Adobe Reader
    http://helpx.adobe.com/acrobat/kb/blocked-plugin-alert-safari-7.html
    Best.

  • How to display Pdf file in iPad site

    Hi
    How to display Pdf file in web page which can able to view in iPad safari?
    Thanks,
    Arun

    You can't really.
    You need to use DHTML in the swf-wrapper HTML file, usually a
    division wrapped iFrame, and load the PDF into the iFrame as an
    overlay to the Flash.

  • How to display pdf file in windows phone 8 silver light application?

    Hi,
    I am developing windows phone 8 silver light application . For my app I want to display pdf files . Is there any default controls to display pdf files ?
    I don't want to display using launchers , I want to display with in the app.
    any help,
    Thanks..
    Suresh.M

    Probably this should give you a fair idea : How to view PDF file inside an Windows Phone application?
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • Is it possible to convert PDF file into HTML

    Dear friends
    Is it possible to convert PDF file into HTML. I have few hundread PDF files i like to convert this files into HTML. I hope it can be done through Java but i don't know how to start this coding. anybody can give me a brief idea to go ahead.

    Why do you want to do this yourself? I quick search on Google showed several utilities to do this, some freeware, some commercial.

  • Html db to display pdf files saved as blob in the data base

    Hi all,
    I have a DB page to call next page to display pdf files.
    A procedure is being called when the link is clicked on the first page.
    However, the procedure output a juck code insteand the pdf files. Please help.
    Thanks,
    n_length number;
    n_image BLOB;
    begin
    select note_image, dbms_lob.getlength(note_image)
    into n_image, n_length
    from n100_notes where note_id = nid;
    owa_util.mime_header('application/pdf');
    htp.p('Content-length: ' || n_length);
    wpg_docload.download_file(note_image );

    we use:
    owa_util.mime_header('application/pdf',false);
    htp.p('Content-Length: ' || dbms_lob.getlength(l_blob));
    owa_util.http_header_close;
    wpg_docload.download_file(l_blob);
    see plpdf.com
    LL

  • How to display pdf file with java code?

    Hi All,
    i have a jsp pagein that page if i click one icon then my backing bean method will call and that method will create pdf document and write some the content in that file and now i want to display that generated pdf document.
    it should look like you have pressed one icon and it displayed pdf file to you to view.
    java code below:
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();
    HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
    resp.setHeader("Content-Disposition", "filename=\"" + temppdfFile);
    resp.encodeRedirectURL(temppdfFile.getAbsolutePath());
    resp.setContentType("application/pdf");
    ServletOutputStream out = resp.getOutputStream();
    ServletUtils.returnFile(temppdfFile, out);
    out.flush();
    and above temppdfFile is my generated pdf file.
    when i am executing this code, it was opening dialog box for save and cancel for the file, but the name of the file it was showing me the "jsp file name" with no file extention (in wich jsp file i am calling my backing bean method) and type is "Unknown File type" and from is "local host"
    it was not showing me open option so i am saving that file then that file saved as a pdffile with tha name of my jsp file and there is nothing in that file(i.e. empty file).
    what is the solution for this. there is any wrong in my code.
    Please suggest me.
    Thanks in advance
    Indira

    public Object buildBarCodes() throws Exception
    File bulkBarcodes = null;
    String tempPDFFile = this.makeTempDir();
    File tempDir = new File("BulkPDF_Files_Print");
    if(!tempDir.exists())
    tempDir.mkdir();
    bulkBarcodes = File.createTempFile
    (tempPDFFile, ".pdf", tempDir);
    //bulkBarcodes = new File(tempDir, tempPDFFile+"BulkBarcode"+"."+"pdf");
    if(!bulkBarcodes.exists())
    bulkBarcodes.createNewFile();
    Document document = new Document();
    FileOutputStream combinedOutput = new FileOutputStream(bulkBarcodes);
    PdfWriter.getInstance(document, combinedOutput);
    document.open();
    document.add(new Paragraph("\n"));
    document.add(new Paragraph("\n"));
    Image image = Image.getInstance(bc.generateBarcodeBytes(bc.getBarcode()));
    document.add(image);
    combinedOutput.flush();
    document.close();
    combinedOutput.close();
    FacesContext facesc = FacesContext.getCurrentInstance();
    ExternalContext ec = facesc.getExternalContext();
    HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
    resp.setHeader("Content-Disposition", "inline: BulkBarcodes.pdf");
    resp.encodeRedirectURL(bulkBarcodes.getAbsolutePath());
    resp.setContentType("application/pdf");
    resp.setBufferSize(10000000);
    ServletOutputStream out = resp.getOutputStream();
    ServletUtils.returnFile(bulkBarcodes, out);
    out.flush();
    return "success";
    This is my action method which will call when ever i press a button in my jsp page.
    This method will create the barcode for the given barcode number and write that barcode image in pdf file
    (i saw that pdf file which i have created through my above method, This PDF file opening when i was opening manually and the data init that is also correct means successfully it writes the mage of that barcode)
    This method taking the jsp file to open because as earlier i said it was trying to open unknown file type document and i saved that file and opended with editplus and that was the jsp file in which file i am calling my action method I mean to say it was not taking the pdf file which i have created above it was taking the jsp file

  • Safari will not display pdf files since installing OS 10.8.2

    Safari will not display pdf files uner Lion 10.8.2

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Display PDF files in Browser

    How can I display PDF files in my browser. SARS reqire it for e-filing?

    Previous error message was working with Explorer. This came up working with Firefox
    I did upgrade and it was found that the latest version was installed.
    Please wait...
    If this message is not eventually replaced by the proper contents of the document, your PDF
    viewer may not be able to display this type of document.
    You can upgrade to the latest version of Adobe Reader for Windows®, Mac, or Linux® by
    visiting http://www.adobe.com/products/acrobat/readstep2.html.
    For more assistance with Adobe Reader visit http://www.adobe.com/support/products/
    acrreader.html.
    Regards
    Allen Versteeg

  • IE 7 not displaying PDF files

    WinXP SP3 desktop
    Installed: Acrobat Reader 9 and Acrobat 6.0 Professional
    Up until recently, when an update from MS and adobe were installed, Internet Explorer 7 has been displaying PDF files when clicking on a link to the document. I do not know which company is at fault for compatibility here, but I would prefer to have IE7 read/save PDF docs. As it is now, an window pops up (no error number) saying "The Adobe Acrobat/Reader that is running can not be used to view PDF files in a Web Browser. Adobe Acrobat/Reader version 8 or 9 is required. Please exit and try again." I click the OK button then Acrobat 6.0 Pro loads and with no document showing. Simply turns on. I open any PDF file manually using either Reader 9 or Pro 6, but IE7 will only come up with above msg.
    Corrective actions attempted were:
    1) Reinstall Reader 9 on top of itself.
    2) In Pro 6, Edit | Preferences | Internet and deselected "Display PDF in browser, restarted program, went back to re-select it, restarted program.
    I did notice a new process running named: wisptis.exe
    The error message above sounds more like to me that the Pro is assigned the job to read downloaded PDF files, but with the Web Browser Option set to "Display PDF in browswer", I do not know why IE7 is not reading them.
    Thank you for your help in advance.
    Kay

    Try troubleshooting the Safari .plist file.
    Quit Safari.
    Open a Finder window. Select your Home Folder in the Sidebar on the left. It has a small house icon. Then open the Library folder then the Preferences folder.
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop.
    Launch Safari. See if that made a difference.
    Also, check Safari / Preferences - Extensions. Make sure it's not an Extension preventing PDF's from rendering.

  • I have acrobat 11 standard is it possible to convert pdf files to word files ?

    I have acrobat 11 standard is it possible to convert pdf files to word files ? or is it just possible in the Pro version.

    It sounds to me like you're using Reader, not Acrobat. Make sure you open
    the PDF file in Acrobat, and then go to File - Save As Other - Microsoft
    Word.
    On Thu, Mar 12, 2015 at 2:55 PM, nickk23435928 <[email protected]>

  • Displaying PDF file in forms running on UNIX server

    I want to display a PDF document in the form.
    I have explored the following two options:-
    1) Using Image item - PDF format is not supported by forms
    2) OLE - Is supported only on WIN and MAC
    Does any body know of any reusable java bean that can be used to display PDF file inside the form?
    Thanks

    Java Beans only work on the Web. If you are on teh Web then an option would be to reference to the pdf document by using web.show_document() built-in
    Frank

  • Displaying PDF file in Flex application

    Hello,
    Is there any way, by which I can read/display PDF file as it is in Flex application (Web based). Is there any way or work around by which I can achieve
    this.
    Awaiting for prompt response.
    Thanks and Regards

    Hello Mariush,
    I have to display the content of the PDF in the flex application. If not PDF directly, is there other workaround for this. Or can I display the content of the MS word file, if not PDF.
    Thanks and Regards
       Khalid Chaudhary

Maybe you are looking for

  • Help! pc to new iMac - HDD not 'seen' on pc... ethernet cable issue too!

    Hi all I just got my new iMac a few days ago and I've tried the ethernet cable and my mac can see the folders on the pc but wont open them! (the original item cannot be found) my ethernet cable isn't linked to the mac now but I can still see my compu

  • Database search using Oracle SES

    Hi all..specially Luca, I am a new to oracle SES.I have to search my database through oracle SES from my ASP.NET pages. But before doing it from ASP.NET page , I just want to try serching from the SES tool itself. I tried to create Database source ty

  • How do I install a patch? (xfce4-power-manager tray icon patch)

    Sorry if this is a stupid question or if the answer can be found elsewhere, but I googled and searched the forums and couldn't find any answers. xfce4-power-manager had for the longest time had a tray icon showing battery status, and they recently de

  • Can I upload PowerPoint directly into Connect without using Adobe Presenter?

    I have a PowerPoint file (.ppt as well as .pptx) and the slides are fairly simple - mostly bullet point lists in Arial or Calibri font (nothing wild and crazy).  When I upload the content directly into the Connect envrionment, the formatting of the s

  • Update rules error urgent

    Hi friends, Iam uploading data Parallely ODS &CUBE. But iam getting Red in ODS and Yellow in CUBE. When i check the error in ods level. showing below error ... Update rules ( 12485  -> 0 Records ) : Errors occurred Fatal error in customer routine 999