A while ago I found out that FOP doesn't allow you to use floats, and a few other features in Xsl-Fo 1.0. I've tried a few different ways to emulate them, but I have had no success. If anyone has had success in this, or has an idea. I would really appreciate enlightenment.
XSL:FO is alive and kicking, not at last since nobody is messing with the specification for the time being. Could it be enhanced, sure. To answer your question: Most PDF generating solutions don't use the template approach that made XML/XSLT/XSL:FO such flexible.
Description. Apache FOP (Formatting Objects Processor) is the world's first print formatter driven by XSL formatting objects (XSL-FO) and the world's first output independent formatter. It is a Java application that reads a formatting object (FO) tree and renders the resulting pages to a specified output.
Definition and Usage The <fo:block> object defines a block of output. Blocks are sequences of output in rectangular boxes. The <fo:block> object is used to format paragraphs, titles, headlines, etc.
To produce a PDF file from a XML file, first step is that we need an XSLT stylesheet that converts the XML to XSL-FO. Created XSL-FO file is also an XML file which contains formatted objects. The second step will be done by FOP when it reads the generated XSL-FO document and formats it to a PDF document.
http://xmlgraphics.apache.org/fop/compliance.html lists which features of XSL-FO are supported in Apache FOP and which are not. Floats have not been implemented, yet.
I know this is an old question, but I had the same problem (I couldn't use float and also couldn't upgrade to a version where I could use float).
I finally settled on keeping an image between two text blocks, the preceding textblock with keep-with-next="always"
and the text after the image with keep-with-previous="always"
.
I found these examples online here. So the text doesn't wrap around the image, but it's above and below the image (it works for large images where text wouldn't wrap around the sides anyway, which was my case, and the preceding/following text isn't too much).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With