0

How can I display a PDF document on a rich:popupPanel. I am trying to display PDF document in a popup from a view scoped JSF page.

Issue faced : Parent page stops working when I click on the h:commandLink which fires a new view to display the PDF

  • Did you solve your problem? Did you find any better? – Emil Sierżęga Mar 16 '16 at 11:54
  • No, I didn't, still looking for an option other than the IFRAME approach – Joyal Augustine Mar 16 '16 at 14:24
  • Don't know why you don't want to use it, but it looks like it isn't a JSF (and like I said in my answer, I'm affraid, that you have to use pure web's posibilities and skip JSF). See f.e.: http://stackoverflow.com/questions/291813/recommended-way-to-embed-pdf-in-html – Emil Sierżęga Mar 16 '16 at 15:04

1 Answers1

0

The simplest way I know is to use HTML directly. You can use IFRAME or OBJECT.

So just put something like this in your rich:popupPanel:

<rich:panel>
    <iframe src="path_to_your_file/sample.pdf" 
    class="pdfFrame" width="800" height="1000" scrolling="no" />
</rich:panel>

I don't think there's a way to do this with pure JSF tags. The same way is presented on PrimeFaces's showcase:

<h3>PDF</h3>
<object type="application/pdf"    
        data="/showcase/resources/demo/media/guide.pdf?pfdrid_c=true" 
        height="300px" width="100%" internalinstanceid="3">

    Your browser can't display pdf,
    <a href="/resources/demo/media/guide.pdf">click</a>
    to download pdf instead.
</object>
Emil Sierżęga
  • 1,785
  • 2
  • 31
  • 38