- From: Jeremias Maerki <dev@jeremias-maerki.ch>
- Date: Fri, 25 May 2012 16:27:18 +0200
- To: www-xsl-fo@w3.org
Hi Léa, take a look at http://xmlgraphics.apache.org/fop/faq.html#pdf-print-contortion HTH Jeremias Maerki On 25.05.2012 12:33:26 Léa Massiot 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:29:09 UTC