2 Replies Latest reply on Apr 7, 2008 11:42 PM by Tom Goring

    Facelet PDF Direct Serving

    Tom Goring Apprentice

      Is it possible to render a PDF generated by facelets directly to the browser without the intermediary  (seam redirect page).

      I have read
      but it seems to be talking about a non-facelet PDF. 


      My web page

      <s:link id="agent-pdf" view="/pdf/MyPdf.xhtml">
      <img src="#{facesContext.externalContext.requestContextPath}/img/pdf.gif" border="0"/>

      My Facelet (MyPdf.xhtml)

      <p:document xmlns:ui="http://java.sun.com/jsf/facelets"
                  margins="0 0 50 50"

      On Ubuntu/Firefox renders a blank screen then the browser opens a new window with the PDF viewer.  I'm left with the blank screen :(

        • 1. Re: Facelet PDF Direct Serving
          Daniel Roth Apprentice

          Could you specify what you mean with directly to the browser. If you mean in-place, I think it is something you configure your browser to do.

          I use some FF plugin for PDF files and every time I click on a pdf file I get to choose if I'd like to open the file in the actual browser, save it or open it in it's targeted application.

          IE7 seems to open pdf files in-place by default, so try using it and see how the pdf file is opened.

          • 2. Re: Facelet PDF Direct Serving
            Tom Goring Apprentice


            The problem is the intermediary page seam generates (while the PDF is generated to the DocumentStore) and then intermediary sends a http redirect to the PDF.

            In my browser Ubuntu/Firefox this leaves a empty window and the PDF is opened in a system PDF viewer.

            If I could generate a link in the source page that generated the PDF directly then it would work OK.  I could do this but I'd have to jump though hoops I think and was wondering if there was an easy way around this.

            Seam intermediary page:

            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Refresh" content="0; URL=GenericPdf.pdf?docId=1&amp;cid=231" /></head><body></body></html>