I want to generate a pdf with a list of images. I suppose them to be shown in the pdf one by one. And, if the two images are size small enough, they can be placed in 1 page together. However, I find that no matter how small the images are, there must be a page break for each image. The sample code is like this: : <fo:block page-break-before="avoid" page-break-after="avoid"> <xsl:for-each select="ADVICE/IMAGE"> <fo:wrapper> <fo:external-graphic> <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute> </fo:external-graphic> </fo:wrapper> </xsl:for-each> </fo:block> : Then, I try to put another text block after the image block like this: <fo:block page-break-before="avoid" page-break-after="avoid"> <xsl:for-each select="ADVICE/IMAGE"> <fo:wrapper> <fo:external-graphic> <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute> </fo:external-graphic> </fo:wrapper> <fo:wrapper>Testing data line</fo:wrapper> </xsl:for-each> </fo:block> <fo:block>Another testing data line</fo:block> The first text 'Testing data line' can be shown just next to the each image sucessfully in the same page. However, the last text 'Another testing data line' cannot be shown in the same page with the last image, even the last image is so small. A page break is forced to appear just after the image. I have tried to use table cell for the display like this, <fo:table> <fo:table-column column-width="20cm"/> <fo:table-body> <xsl:for-each select="ADVICE/IMAGE"> <fo:table-row> <fo:table-cell display-align="center"> <fo:block text-align="center"> <fo:external-graphic display-align="center" text-align="center"> <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute> </fo:external-graphic> </fo:block> </fo:table-cell> </fo:table-row> </xsl:for-each> </fo:table-body> </fo:table> But the result is still the same. On the other hand, I just put the same coding in the static content as region- before, it can be shown successfully without page break (I think it is still to region-before cannot be page break). Is it the internal problem of FOP? Anything we can do to help? SL
Really, the biggest help would be to post a FO document (no XSL, just the FO...i.e. do your XML transformation and produce an FO document) and set of graphics that we can use as a test case. Also, you may wish to check out a more recent version of FOP and see if the issue recurrs. The test case is most important to us, however.
Created attachment 4035 [details] fo file
Created attachment 4037 [details] image 1
Created attachment 4038 [details] image 2
Created attachment 4039 [details] image 3
Created attachment 4040 [details] image 4
I have attached the fo and images file for your reference. The reason that we use 20.3 rather 20.4 is we find that 20.4 has out of memory problem when removing the embed-file attribute from the userconfig.xml. We have to generate a pdf for muti-asian languages, therefore, we have to choose a lower version.
page-break-before="avoid" is a shorthand of keep-with-previous="always" (the same for page-break-after="avoid"), but it's documented limitation of the current version that keep properties are only supported on table rows. It's addressed by the redesign process under way. Usual workaround is a blind table with keep-* properties on its rows. *** This bug has been marked as a duplicate of 3044 ***
batch transition to closed remaining pre-FOP1.0 resolved bugs