My current FOP task is filling a sequence of pages with a matrix of id cards. Including bleed space of 2mm, each card occupies an area of 84mm x 58mm. I want to fill my page (size: 450mm x 320mm) without any gap between the cards. My computation goes as follows: <xsl:variable name="PaperWidth">450</xsl:variable> <xsl:variable name="PaperHeight">320</xsl:variable> <xsl:variable name="CardWidth">84</xsl:variable> <!-- including 2mm bleed --> <xsl:variable name="CardHeight">58</xsl:variable> <!-- including 2mm bleed --> <xsl:variable name="MinPrintMargin">10</xsl:variable> <xsl:variable name="CardHorCount" select="floor(($PaperWidth - 2 * $MinPrintMargin) div $CardWidth)" as="xs:integer"/> <xsl:variable name="CardVerCount" select="floor(($PaperHeight - 2 * $MinPrintMargin) div $CardHeight)" as="xs:integer"/> <xsl:variable name="RestMarginHor" select="$PaperWidth - $MinPrintMargin - ($CardHorCount * $CardWidth)" /> <xsl:variable name="RestMarginVer" select="$PaperHeight - $MinPrintMargin - ($CardVerCount * $CardHeight) - $SpaceOfUnknownOrigin" /> <xsl:variable name="SpaceOfUnknownOrigin">10</xsl:variable> <xsl:template match="/"> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:call-template name="NormalPage"/> <fo:page-sequence master-reference="Repeat-Normal"> <fo:flow flow-name="xsl-region-body"> <xsl:apply-templates select="IDCards/IDCard" /> </fo:flow> </fo:page-sequence> </fo:root> </xsl:template>
As one might notice, there is a strange correction value (SpaceOfUnknownOrigin) necessary for vertical adjustment. If I do not reduce the margin size that theoretically should remain vertically, the last row of the cards will appear on next page. My page setup is quite simple, I use columns to spread horizontally: <xsl:template name="NormalPage"> <fo:layout-master-set> <fo:simple-page-master master-name="Normal" page-width="{$PaperWidth}mm" page-height="{$PaperHeight}mm"> <fo:region-body margin="{$MinPrintMargin}mm {$RestMarginHor}mm {$RestMarginVer}mm {$MinPrintMargin}mm" column-count="{$CardHorCount}" column-gap="0mmt" /> </fo:simple-page-master> <fo:page-sequence-master master-name="Repeat-Normal"> <fo:repeatable-page-master-reference master-reference="Normal"/> </fo:page-sequence-master> </fo:layout-master-set> </xsl:template> Now comes the interesting part, the template that prints each id card: <xsl:template match="IDCard"> <fo:block-container> <fo:block space-before="0mm" space-after="-1mm"> <fo:external-graphic src="url(Images/{...@picture})" /> </fo:block> <!-- <fo:block-container absolute-position="absolute" top="48mm" left="0mm" width="84mm" height="12mm"> <fo:block width="100%" text-align="center" font-family="Helvetica" font-style="normal" font-size="14pt" font-weight="normal"> <xsl:value-of select="@text" /> </fo:block> </fo:block-container> --> </fo:block-container> </xsl:template> What I intend is putting a matrix of images (always of size 1982px x 1369px, 600dpi which is exactly 58mm high) and overwriting each with a short text that is positioned absolutely (inside of the image area). My observations of FOP behavior identify 4 cases: Case 1, FOP 0.95: absolute text area inside commented out (thus no text shown in PDF): Visible vertical space between card rows is about 2mm (if space-after=0), 1mm (if space-after=-1mm) or zero as intended (if space-after=-2mm). Case 2, FOP 0.95: absolute text area is included: Visible vertical space between cards seems to be like the text height (which is about 10mm). Last row of cards exceeds paper size, print is cut. Defining a value for height of absolute block makes space between cards larger and seemingly equal to area height. Including such an absolute area, the result of FOP 0.95 becomes completely unusable. Case 3: like case 1 but with FOP 0.94: Older FOP behaves similar to latest version. But there is a strange difference between behavior in cases 3 and 4: Setting space-after as well as space-before to 1mm, case 3 leaves a gap of 1mm. However, the same values along with absolute area included (case 4) removes the visible gap exactly as it is when I define space-before=0 and space-after=2mm. space-before seems to have no effect unless some absolute computing is involved. Case 4: like case 2 but with FOP 0.94: Older FOP can handle absolute areas as I would expect them. Visible space between cards is like in case 1, thus I can use this combination to print the ID cards without gap (though I do not understand why I have to specify negative space-after). It seems to me as if the whole context of variants is important for isolating the unwanted behaviour. Now my questions: Q A: Where does the additional vertical space come from? Q B: How can I avoid to define negative values if I just want zero gaps? Q C: Considering the acceptable result with 0.94 in case 4, I would suggest that there is a severe bug in 0.95 concerning the handling of absolute areas. Or is my way of using absolute positioning wrong? Q D: I do not thoroughly understand absolute positioning in FO and derived my code from another posting. Where I can read a sound explanation of the concepts behind? Thanks for any suggestions, Richard -- View this message in context: http://www.nabble.com/Unwanted-vertical-gaps-%28different-if-absolute-blocks-present%29-tp26085279p26085279.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org