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

    Facelet PDF Direct Serving

    tom_goring

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


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


      I.e.


      My web page


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



      My Facelet (MyPdf.xhtml)


      <p:document xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:f="http://java.sun.com/jsf/core"
                  xmlns:jnet="http://jnet.ltd.uk/taglib"
                  xmlns:p="http://jboss.com/products/seam/pdf"
                  margins="0 0 50 50"
                  >
      ...                                            
      </p:document>
      






      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

          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

            Hi,


            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>