2 Replies Latest reply on Oct 2, 2007 1:52 AM by siven555

    Printing problem

    siven555

      I am working on a Seam project using jsf 1.1 facelets deployed on jboss

      I am trying to use a Stylesheet to hide certain features from being printed. But I'm having problems with linking the external stylesheet. The link tag only works when it is inside the first <ui:define> tag and it hides the guidelinesMenuTree, but does not work elsewhere. For instance, the italicText does not change the text to italics, nor do the other classes work.

      I tried to put the classes directly inside this file within style tags but this does not work either.

      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:c="http://java.sun.com/jstl/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:t="http://myfaces.apache.org/tomahawk"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:sand="http://myfaces.apache.org/sandbox"
       xmlns:fck="http://www.fck-faces.org/fck-faces">
      
      
      <body>
      
      <ui:composition template="searchTemplate.xhtml">
      
       <ui:define name="sidebar">
      
       <link rel="stylesheet" href="style/default/guidelinePrint.css" type="text/css" media="print"/">
      
       <t:div styleClass="hide">
       <ui:include src="/guidelinesMenuTree.xhtml"/>
       </t:div>
      
      
       </ui:define>
      
       <ui:define name="container">
      
      
       <f:loadBundle basename="messages" var="constantsBundle" />
       <script type="text/javascript" src="javascript/ajaxtabs.js"/>
      
       <f:loadBundle basename="messages" var="msg" />
      
      
      
       <f:view>
      
       <link rel="stylesheet" href="style/default/guidelinePrint.css" type="text/css" media="print"/>
       <h:form>
      
      
       <t:div rendered="#{!guidelineEditorBean.editMode}">
      
       <h:outputText styleClass="italicText" value="#{guidelineEditorBean.selectedPageView.page.pageName}"/><br/>
      
       <t:outputHtml value="#{guidelineEditorBean.selectedPageView.page.content}"/>
      
      
       <h:commandLink value="Print" onclick="window.print(); return false"/>
      
      
       </t:div>
      
       </h:form>
      
       </f:view>
      
       </ui:define>
       </ui:composition>
      </body>
      </html>
      -----------------------------------------------------------------
      
      guidelinePrint.css
      
      
      
      .boldText
      {
       font-weight : bold;
      }
      .hide
      {
       display : none;
      }
      
      .show
      {
       display : block;
      }
      .italicText
      {
       font-weight : italic;
      }
      
      


        • 1. Re: Printing problem
          samppaa

          Try adding the

          <link rel="stylesheet" href="style/default/guidelinePrint.css" type="text/css" media="print"/">
          


          inside html head elements

          <html>
          <head>
          <link rel="..." />
          </head>
          <body>
          </body>
          </html>
          
          


          I don't think it works on the body of the document.

          -Samppa

          • 2. Re: Printing problem
            siven555

            It doesn't work in the head tag, that is the reason I tried putting it in the body, where it works in sidebar but doesn't work in container.