2

This is a follow-up question on Block Image Right and Flow Text Around It?. As answered there, wrapping text around images was not possible with Apache FOP 1.1.

A few months ago, V2.0 was released. According to the compliance page there is partial support for floats.

As i am new to XSLT / FOP (and do not know how to interpret the restrictions reported there), I would like to whether wrapping text around pictures works with 2.0 in general. (It would be great if someone could provide a demo-pdf generated with Apache FOP 2.0)

Community
  • 1
  • 1
P. Schooft
  • 25
  • 6

1 Answers1

1

fo:float works in FOP 2.0 since they list it as one of the main new features of FOP 2.0. You will have to experiment with your content to see if the restrictions cause unwanted text wrapping around your images. Since FOP 2.0 doesn't support the clear attribute on floats you might have overlapping images if you have too many floats within the same horizontal area of the page.

I have been using Antenna House Formatter since 2002 since it supported way more features than the early version of FOP. If the partial support for floats in FOP 2.0 doesn't meet your needs, you can pay for a better tool that has full float support.

http://xmlgraphics.apache.org/fop/fo.html#floats

Floats (fo:float) are supported with some limitations:

  • the "clear" fo:float attribute is ignored; only the float attribute (left or right) is used

  • overlapping of floats in the Y is not handled (even in the case there would not be overlap in the X direction)

  • floats that extend beyond the body region are not properly handled and will overflow past the edge of the region

  • if a float extends to bottom of the body region and there are footnotes in the page the float may overlap with the footnote region

  • floats next to a table are not supported unless the start and end of the table happens in between the start and end of the float

It would be more useful if you modified your files, but you can modify the example fo files with images to see how fo:float works. I slightly modified this file "fop-2.0\examples\fo\basic\alignment.fo":

<fo:float float="left">
<fo:block>
<fo:instream-foreign-object vertical-align="top">
<svg:svg width="25" height="25">
  <svg:rect x="0" y="0" width="25" height="25" style="fill:none;stroke:#000000"/>
  <svg:line x1="12.5" y1="3" x2="12.5" y2="22" style="stroke:black;stroke-width:1.5"/>
  <svg:path d="M5 17l7.5 8l7.5 -8z" style="fill:black"/>
  <svg:path d="M5 8l7.5 -8l7.5 8z" style="fill:black"/>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:float>
Community
  • 1
  • 1
Jeremy Odekirk
  • 594
  • 3
  • 13
  • 1
    Thank you! That's the answer I wanted/needed. Meanwhile, I got a minimal example working and I can confirm your statements. In general, floats works. However if the position of the picture come to close to the page body, the picture will ignore any boundaries (body and even page size) – P. Schooft Oct 21 '15 at 19:56