Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSL:FO, Floats in F.O.P

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.

like image 446
Meiscooldude Avatar asked Jul 23 '09 18:07

Meiscooldude


People also ask

Is XSL-FO still used?

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.

What is FOP jar?

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.

What is Fo block?

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.

How do I create an XML PDF using Apache FOP?

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.


2 Answers

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.

like image 82
Jeremias Märki Avatar answered Nov 06 '22 00:11

Jeremias Märki


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).

like image 43
Togepi Avatar answered Nov 05 '22 22:11

Togepi