W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2012

Re: xsl fo pdf fop - Not getting the expected dimensions

From: Léa Massiot <lmhelp1@orange.fr>
Date: Tue, 29 May 2012 02:02:31 -0700 (PDT)
Message-ID: <33923842.post@talk.nabble.com>
To: www-xsl-fo@w3.org

Hello Jeremias,

- I printed the PDF document you attached choosing "Actual size" at print
time.
=> Yes, the various dimensions are correct (modulo 1mm).

- Imitating the FO document you attached, I tried generating the PDF file
using the below XSL-FO stylesheet (n°1).
=> And again the dimensions are correct.
(BTW, it also works with "DarkSlateGray" instead of "orange" as the
"fo:region-body" background color.)

- I also tested my original XSL-FO stylesheet (cf. XSL-FO stylesheet n°2
below) which is also properly rendered...

A great thank you for your help and for sending the FO and PDF attachments.
It really helped.
Best regards,
--
Léa


**** XSL-FO stylesheet n°1

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:fo="http://www.w3.org/1999/XSL/Format">
                              
  <xsl:template match="/">
    
    <fo:root>
    
      <fo:layout-master-set>
        <fo:simple-page-master master-name = "A4-portrait" 
                               page-height="29.7cm" 
                               page-width="21.0cm" 
                               margin="2cm"                                        
                               >
                                       
          <fo:region-body background-color="DarkSlateGray" />
          
        </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="A4-portrait">
        <fo:flow flow-name="xsl-region-body">
          <fo:block background-color="gray"
                    padding-left="5cm"
                    margin-left="4cm">
            Hello
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
        
  </xsl:template>
  
</xsl:stylesheet>



**** XSL-FO stylesheet n°2

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:fo="http://www.w3.org/1999/XSL/Format">
                              
  <xsl:template match="quotation">
    
    <fo:root>
    
      <fo:layout-master-set>
        <fo:simple-page-master master-name = "A4-portrait" 
                               page-height="{@page_height}" 
                               page-width="{@page_width}" 
                               margin="{@margin}"                                        
                               >
                                       
          <fo:region-body background-color="orange" />
          
        </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="A4-portrait">
        <fo:flow flow-name="xsl-region-body">
          <xsl:apply-templates select="area" />
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
        
  </xsl:template>
  
  <xsl:template match="area">
    <fo:block-container position = "absolute"
                        top      = "{top}"
                        left     = "{left}" 
                        width    = "{width}">
      <fo:block background-color="gray">
        <xsl:value-of select="content" />
      </fo:block>
    </fo:block-container>
  </xsl:template>
</xsl:stylesheet>



**** XML

<?xml version="1.0" encoding="UTF-8"?>
<quotation page_height="29.7cm" 
           page_width="21.0cm"
           margin="2cm">
  <area>
    <top>1cm</top>
    <left>2cm</left>
    <height>20cm</height>
    <width>10cm</width>
    <content>
      Hello
    </content>    
  </area>
</quotation>



Jeremias Maerki-2 wrote:
> 
> Léa,
> I stand by my comment earlier. It must be the "Size Options" in Acrobat
> Reader's print dialog. It must be on "Actual Size". Or a setting in the
> printer driver. Have you tried a different printer?
> 
> I've had to change the color name, too, and added another background
> color for illustration. Here's the FO and PDF generated with Apache FOP
> 1.0. Printed out, the sizes are withing mechanical tolerance, i.e. shift
> of the whole page content < 1mm.
> 
> The ten-thousands of users of Apache FOP would cut our collective heads
> off, if there was a bug as serious as considerable size deviations.
> 
> Jeremias Maerki
> 

-- 
View this message in context: http://old.nabble.com/xsl-fo-pdf-fop---Not-getting-the-expected-dimensions-tp33907126p33923842.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Tuesday, 29 May 2012 09:03:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 29 May 2012 09:03:02 GMT