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

Léa,

This is not an XSL-FO specification/standards issue. Please move this
thread to the <fop-users@xmlgraphics.apache.org> mail list.

Regards,
Glenn

On Fri, May 25, 2012 at 4:33 AM, Léa Massiot <lmhelp1@orange.fr> wrote:

> 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"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                              xmlns:fo="http://www.w3.org/1999/XSL/Format">
>
>  <xsl:template match="quotation">
>
>    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>
>      <fo:layout-master-set>
>        <fo:simple-page-master master-name = "simple_page_master"
>                               page-height = "{@page_height}"
>                               page-width  = "{@page_width}"
>                               >
>
>          <fo:region-body />
>
>        </fo:simple-page-master>
>      </fo:layout-master-set>
>
>      <fo:page-sequence master-reference="simple_page_master">
>        <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">
>
>    <xsl:variable name="top">
>      <xsl:value-of select="top" />
>    </xsl:variable>
>
>    <xsl:variable name="left">
>      <xsl:value-of select="left" />
>    </xsl:variable>
>
>    <xsl:variable name="height">
>      <xsl:value-of select="height" />
>    </xsl:variable>
>
>    <xsl:variable name="width">
>      <xsl:value-of select="width" />
>    </xsl:variable>
>
>    <fo:block-container position = "absolute"
>              top      = "{$top}"
>              left     = "{$left}"
>              height   = "{$height}"
>              width    = "{$width}"
>              background-color = "DarkSlateGray">
>
>      <fo:block>
>        <xsl:value-of select="content" />
>      </fo:block>
>
>
>    </fo:block-container>
>  </xsl:template>
>
> </xsl:stylesheet>
>
>
> XML data
>
> <?xml version="1.0" encoding="UTF-8"?>
> <quotation page_height='297mm'
>           page_width='210mm'>
>  <area>
>      <top>0mm</top>
>      <left>0mm</left>
>      <height>200mm</height>
>      <width>100mm</width>
>      <content>Hello World</content>
>  </area>
> </quotation>
>
> --
> 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:24:01 UTC