3 Replies Latest reply on Aug 30, 2007 4:02 AM by Natalia Ponomareva

    pdf in Internet Explorer is not working

    Natalia Ponomareva Newbie

      Hey guys, i hope somebody knows what i am doing wrong. I am using iText with Seam to create a dynamic pdf document.
      The pdf is fine while viewing it in Firefox, but when i am trying to view pdf in Internet Explorer, it shows only header and doesn't render the rest of the document.
      Here are my configs :
      components.xml

      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:core="http://jboss.com/products/seam/core"
       xmlns:framework="http://jboss.com/products/seam/framework"
       xmlns:drools="http://jboss.com/products/seam/drools"
       xmlns:security="http://jboss.com/products/seam/security"
       xmlns:mail="http://jboss.com/products/seam/mail"
       xmlns:web="http://jboss.com/products/seam/web"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:pdf="http://jboss.com/products/seam/pdf"
       xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.2.xsd
       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd
       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-1.2.xsd
       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd
       http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-1.2.xsd">
      ...
      <pdf:documentStore useExtensions="true" errorPage="/pdfMissing.seam"/>
      
      ...


      web.xml
      ....
      <servlet>
       <servlet-name>Document Store Servlet</servlet-name>
       <servlet-class>org.jboss.seam.pdf.DocumentStoreServlet</servlet-class>
      </servlet>
      
      <servlet-mapping>
       <servlet-name>Document Store Servlet</servlet-name>
       <url-pattern>*.pdf</url-pattern>
      </servlet-mapping>
      


      I am using backing bean defined as
      @Name("pdfBean")
      @Scope(ScopeType.PAGE)
      public class PDF implements Serializable
      ...


      calling the pdf
      <s:link id="link_pdf_details"
       action="#{pdfBean.init}"
       view="/pdfView.xhtml"
       target="_blank">
       <h:graphicImage value="/img/printpdf.png"/>
       <f:param name="id" value="#{id}"/>
      </s:link>


      Does anyone know how to fight that?

        • 1. Re: pdf in Internet Explorer is not working
          Natalia Ponomareva Newbie

          hey i found what was wrong. i saw in documentation that in order to iterate through collection, ui:iterate can be used. So i guess back then i assumed that ui:include can be used as well. i had pdf that was supposed to show either pdf of one style or another. And that was done this way

          <p:document xmlns:f="http://java.sun.com/jsf/core"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:s="http://jboss.com/products/seam/taglib"
           xmlns:p="http://jboss.com/products/seam/pdf"
           xmlns:h="http://java.sun.com/jsf/html">
          
           <h:panelGroup rendered="#{!pdfBean.defaultStyle}" >
           <ui:include src="/pdf/defaultPDF.xhtml"/>
           </h:panelGroup>
          
           <h:panelGroup rendered="#{pdfBean.defaultStyle}" >
           <ui:include src="/pdf/anotherStylePDF.xhtml"/>
           </h:panelGroup>
          
          
          </p:document>


          And then each of xhtml documents were a pdf as well. I guess ui:include redirects the request, and now i am wondering why firefox was showing that correctly. anyway, the same thing can be achived this way, and this works in IE (at least on IE7)

          <f:view xmlns:f="http://java.sun.com/jsf/core"
           xmlns:ui="http://java.sun.com/jsf/facelets"
           xmlns:h="http://java.sun.com/jsf/html">
          
           <h:panelGroup rendered="#{!pdfBean.defaultStyle}">
           <ui:include src="/pdf/defaultPDF.xhtml"/>
           </h:panelGroup>
          
           <h:panelGroup rendered="#{pdfBean.defaultStyle}" >
           <ui:include src="/pdf/anotherStylePDF.xhtml"/>
           </h:panelGroup>
          </f:view>


          I hope it will help somebody someday :)



          • 2. Re: pdf in Internet Explorer is not working
            Norman Richards Master

            Thanks. I'm not sure exactly what difference it makes, but if you can record a JIRA issue for it, I'll track it down and make sure things work more consistently.

            • 3. Re: pdf in Internet Explorer is not working
              Natalia Ponomareva Newbie

              I created JIRA issue, it can be found here http://jira.jboss.org/jira/browse/JBSEAM-1884. Thanks for ur time, Norman!