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

xsl fo pdf fop - Not getting the expected dimensions

From: Léa Massiot <lmhelp1@orange.fr>
Date: Fri, 25 May 2012 03:33:26 -0700 (PDT)
Message-ID: <33907126.post@talk.nabble.com>
To: www-xsl-fo@w3.org
Hello and thank you for reading my post.

Below are the XSL stylesheet and the XML data files I am using.
Given these two files and using "fop" (1.0) emebeded in a Java application I
generate a resulting PDF document which basically consists of a 210mm x
297mm page containing a rectangle with the "Hello World" string inside.
My problem is that, even though I am specifying I would like that rectangle
to be 100mm x 200mm in the XML file (see below), I get a 94mm x 189mm area
when I print the generated PDF document and measure it with a ruler.

Can you help me understand what's happening?

I was wondering if maybe some kind of "reset" (comparable to a CSS reset
like *{padding: 0; margin: 0;}) might have to be done prior to working?

Thank you for helping.
Best regards.

XSL stylesheet

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

      <fo:page-sequence master-reference="simple_page_master">
        <fo:flow flow-name="xsl-region-body">
          <xsl:apply-templates select="area" />
  <xsl:template match="area">
    <xsl:variable name="top">
      <xsl:value-of select="top" />
    <xsl:variable name="left">
      <xsl:value-of select="left" />
    <xsl:variable name="height">
      <xsl:value-of select="height" />
    <xsl:variable name="width">
      <xsl:value-of select="width" />
    <fo:block-container position = "absolute"
              top      = "{$top}"
              left     = "{$left}"
              height   = "{$height}"
              width    = "{$width}"
              background-color = "DarkSlateGray">
        <xsl:value-of select="content" />


XML data

<?xml version="1.0" encoding="UTF-8"?>
<quotation page_height='297mm' 
      <content>Hello World</content>    

View this message in context: http://old.nabble.com/xsl-fo-pdf-fop---Not-getting-the-expected-dimensions-tp33907126p33907126.html
Sent from the w3.org - www-xsl-fo mailing list archive at Nabble.com.
Received on Friday, 25 May 2012 14:04:58 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:36 UTC