title: xsl fo page size / orientation
body: <p>I am designing an xsl that will give a pdf output. My pdf output is in landscape format.
  I can't get the landscape formatted output even i change the simple page master as follows,</p>
  
  <p>Still my pdf output's height is greater than the width.</p>
  
  <p>Hi mzjn, i dont have any link. attached the expected and resulted pdf outputs, <img src="https://i.stack.imgur.com/w52jS.jpg" alt="resulted pdf - rotated clockwise"> <img src="https://i.stack.imgur.com/BNs7r.jpg" alt="expected">also need to know how to use the border image. tried as background image for region body and failed.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;xsl:stylesheet version="1.1"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
  exclude-result-prefixes="fo"&gt;
  &lt;xsl:output method="xml" version="1.0" omit-xml-declaration="no"
      indent="yes" /&gt;
  &lt;xsl:param name="versionParam" select="'1.0'" /&gt;
  &lt;xsl:template match="@*|node()"&gt;
      &lt;fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"&gt;
          &lt;!-- Start of page layout --&gt;
          &lt;fo:layout-master-set&gt;
              &lt;fo:simple-page-master master-name="A4"
                  page-width="8.27in" page-height="11.69in" margin-top="5mm"
                  margin-bottom="5mm" margin-left="5mm" margin-right="5mm"
                  reference-orientation="90"&gt;
                  &lt;fo:region-body margin-top=".5cm" margin-bottom=".5cm"
                      margin-left=".5cm" margin-right=".5cm"&gt;
                      &lt;xsl:if test="isPreview='true'"&gt;
                          &lt;xsl:attribute name="background-image"&gt;file:///&lt;xsl:value-of
                              select="pdfimagepath" /&gt;Preview Only1.JPG&lt;/xsl:attribute&gt;
                      &lt;/xsl:if&gt;
                  &lt;/fo:region-body&gt;
                  &lt;fo:region-before extent="0mm" /&gt;
                  &lt;fo:region-after extent="0mm" /&gt;
  
              &lt;/fo:simple-page-master&gt;
          &lt;/fo:layout-master-set&gt;
          &lt;!-- End of page layout --&gt;
  
          &lt;fo:page-sequence master-reference="A4"&gt;
              &lt;fo:static-content flow-name="xsl-region-before"&gt;
                  &lt;fo:block&gt;
                      &lt;fo:leader&gt;&lt;/fo:leader&gt;
                  &lt;/fo:block&gt;
                  &lt;fo:block text-align="right" font-size="9pt" font-weight="bold"&gt;
                      &lt;xsl:value-of select="num" /&gt;
                  &lt;/fo:block&gt;
              &lt;/fo:static-content&gt;
              &lt;fo:static-content flow-name="xsl-region-after"&gt;
                  &lt;fo:block font-size="9pt" font-family="times" text-align="left"&gt;
  
                      &lt;xsl:value-of select="xxx" /&gt;
                  &lt;/fo:block&gt;
              &lt;/fo:static-content&gt;
  
              &lt;fo:flow flow-name="xsl-region-body"&gt;
                  &lt;fo:block&gt;
                      &lt;fo:table table-layout="fixed" width="100%"&gt;
                          &lt;fo:table-header&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell&gt;
                                      &lt;fo:block&gt;&lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-header&gt;
                          &lt;fo:table-body&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell width="100%"&gt;
                                      &lt;fo:block text-align="center" padding-top="2pt"&gt;
                                          &lt;fo:external-graphic content-height="85%"
                                              content-width="65%" scaling="uniform"&gt;
                                              &lt;xsl:attribute name="src"&gt;
                                  &lt;xsl:value-of select="pdfimagepath" /&gt;LogoCert.jpg
                                  &lt;/xsl:attribute&gt;
                                          &lt;/fo:external-graphic&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell width="100%"&gt;
                                      &lt;fo:block text-align="center"&gt;
                                          &lt;fo:external-graphic content-height="45%"
                                              content-width="55%" scaling="non-uniform"&gt;
                                              &lt;xsl:attribute name="src"&gt;
                                      &lt;xsl:value-of select="pdfimagepath" /&gt;title.jpg
                                      &lt;/xsl:attribute&gt;
                                          &lt;/fo:external-graphic&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell width="100%"&gt;
                                      &lt;fo:block font-size="15.5pt" font-family="Arial"
                                          color="Black" text-align="center" padding-before="5pt"
                                          start-indent="10pt"&gt;
                          &lt;/fo:block&gt;
                                      &lt;fo:block font-size="15.5pt" font-family="Arial"
                                          color="Black" text-align="center" start-indent="5pt"&gt;xxxxxx:
                          &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell width="100%"&gt;
                                      &lt;fo:block font-size="16.5pt" font-family="Arial"
                                          color="red" text-align="center" padding-before="8pt"&gt;
                                          &lt;xsl:value-of select="custname" /&gt;
  
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell width="100%"&gt;
                                      &lt;fo:block font-size="13.5pt" font-family="Arial"
                                          color="black" text-align="center" padding-before="10pt"
                                          start-indent="10pt"&gt;
                                          &lt;fo:inline background-color="yellow"&gt;xxxx&lt;/fo:inline&gt;xxxx
                                      &lt;/fo:block&gt;
                                      &lt;fo:block font-size="13.5pt" font-family="Arial"
                                          color="black" text-align="center" start-indent="10pt"&gt; xxxx
                          &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-start="140pt" padding-end="140pt"&gt;
                                      &lt;fo:block font-size="10pt" font-family="Arial" color="black"
                                          text-align="center" border-bottom="solid"&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell display-align="after"
                                      padding-after="12pt" padding-before="2pt"&gt;
                                      &lt;fo:block font-size="15.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; xxxx
                          &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-start="160pt" padding-end="160pt"&gt;
                                      &lt;fo:block font-size="10pt" font-family="Arial" color="black"
                                          text-align="center" border-bottom="solid"&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
  
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-before="2pt"
                                      display-align="before"&gt;
                                      &lt;fo:block font-size="15.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; 
                                                  &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-before="10pt"&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; xxxx
                                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt;
                                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; 
                                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; 
                                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt;
                                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" font-family="Arial"
                                          color="black" text-align="center"&gt; 
                                                  &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
  
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-before="5pt"
                                      padding-start="60pt" padding-end="60pt"&gt;
                                      &lt;fo:block font-size="20pt" font-family="Arial" color="black"
                                          text-align="center" border-bottom="solid"&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-body&gt;
                      &lt;/fo:table&gt;
                      &lt;fo:table table-layout="fixed" width="100%"&gt;
                          &lt;fo:table-column column-width="40%" /&gt;
                          &lt;fo:table-column column-width="60%" /&gt;
                          &lt;fo:table-header&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell&gt;
                                      &lt;fo:block&gt;&lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-header&gt;
                          &lt;fo:table-body&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-before="5pt"&gt;
                                      &lt;fo:block font-size="9.5pt" text-align="left"
                                          font-weight="normal"&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                                  &lt;fo:table-cell padding-before="5pt"&gt;
                                      &lt;fo:block font-size="9.5pt" text-align="center"&gt; 
                                      &lt;/fo:block&gt;
                                      &lt;fo:block font-size="9.5pt" text-align="center"
                                          end-indent="10pt"&gt; 
                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-body&gt;
                      &lt;/fo:table&gt;
                      &lt;fo:table table-layout="fixed" width="100%"&gt;
                          &lt;fo:table-column column-width="50%" /&gt;
                          &lt;fo:table-column column-width="50%" /&gt;
                          &lt;fo:table-header&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell&gt;
                                      &lt;fo:block&gt;&lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-header&gt;
                          &lt;fo:table-body&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell padding-before="5pt"
                                      display-align="after" border=""&gt;
                                      &lt;fo:block font-size="10pt" text-align="left"
                                          font-weight="normal"&gt;
                                      &lt;/fo:block&gt;
                                      &lt;fo:block font-size="13.5pt" text-align="center"
                                          font-weight="normal"&gt; 
                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                                  &lt;fo:table-cell padding-before="5pt"
                                      display-align="after" border=""&gt;
                                      &lt;fo:block text-align="center"&gt;
                                          &lt;fo:external-graphic content-height="60%"
                                              content-width="40%" scaling="uniform"&gt;
                                              &lt;xsl:attribute name="src"&gt;
                                  &lt;xsl:value-of select="pdfimagepath" /&gt;sign.jpg
                                  &lt;/xsl:attribute&gt;
                                          &lt;/fo:external-graphic&gt;
                                      &lt;/fo:block&gt;
                                      &lt;fo:block padding-bottom="1pt" font-size="15pt"
                                          text-align="center" font-weight="bold"&gt;
                                          _____________________________
                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                              &lt;fo:table-row&gt;
                                  &lt;fo:table-cell display-align="after" border=""&gt;
                                      &lt;fo:block font-size="8pt" text-align="left"
                                          font-weight="normal"&gt;
                                      &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                                  &lt;fo:table-cell display-align="after" border=""
                                      padding-before="1pt"&gt;
                                      &lt;fo:block font-size="8.5pt" text-align="center"
                                          font-weight="normal"&gt;xxxxx
                                  &lt;/fo:block&gt;
                                      &lt;fo:block font-size="8.5pt" text-align="center"
                                          font-weight="normal"&gt;yyyyy
                                  &lt;/fo:block&gt;
                                  &lt;/fo:table-cell&gt;
                              &lt;/fo:table-row&gt;
                          &lt;/fo:table-body&gt;
                      &lt;/fo:table&gt;
                  &lt;/fo:block&gt;
              &lt;/fo:flow&gt;
          &lt;/fo:page-sequence&gt;
  &lt;/fo:root&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>code sample attached</p>