> Hello together,
> 
> can anybody told me how to generate PDF with landscape format?
> 
> Thanks
> 
> Jan

Here's a method we use in all of our reports, user has a check box which set
an input parameter, "doc-orientation", passed to the FOP servlet.


  <xsl:param name="doc-orientation" select="'portrait'"/>

         .  
         .  
         .  
 

 <!-- Page orientation determined by 'doc-orientation' input parameter  -->

  <xsl:variable name="pageheight">
    <xsl:choose>
      <xsl:when test="$doc-orientation='landscape'">8.5</xsl:when>
      <xsl:otherwise>11</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="pagewidth">
    <xsl:choose>
      <xsl:when test="$doc-orientation='landscape'">11</xsl:when>
      <xsl:otherwise>8.5</xsl:otherwise>
   </xsl:choose>
  </xsl:variable>

         .  
         .  
         .  
 
 <!-- Local variables, derived from page dimensions and orientation -->

  <xsl:variable name="margin" select="0.5"/>
  <xsl:variable name="region-margin" select="0.5"/>
  <xsl:variable name="bodywidth" select="$pagewidth - ((2 * $margin) +
$region-margin)"/>
 
        .  
         .  
         .  

 
    <fo:layout-master-set>
        <fo:simple-page-master master-name="Report-Page"
            page-height="{$pageheight}in"
            page-width="{$pagewidth}in"
            margin-left="{$margin + 0.25}in"
            margin-right="{$margin + 0.25}in"
            margin-top="{$margin}in"
            margin-bottom="{$margin}in">
            <fo:region-before extent="{$region-margin}in"/>
            <fo:region-after extent="{$region-margin}in"/>
            <fo:region-body margin-top="{$region-margin}in"
margin-bottom="{$region-margin}in" />
        </fo:simple-page-master>


        <!-- Set up the sequence of pages -->
        
        <fo:page-sequence-master master-name="Report-Contents">
            <fo:repeatable-page-master-alternatives>
                <fo:conditional-page-master-reference
master-reference="Report-Page" odd-or-even="any"/>
            </fo:repeatable-page-master-alternatives>
        </fo:page-sequence-master>
    </fo:layout-master-set>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to