Question

Question: Does NFop support floats?

Background: I have the requirement to generate a printable report, containing page numbers, corporate logo and a table of data. The report is for a web based project, and initially I was thinking of doing it in pure HTML with a CSS print stylesheet, however the page numbers and splitting of table cells seems to be an issue.

Because of this, I decided to go the PDF generation route, using XSL to generate the XSL-FO and using NFop to generate the PDF. However, it seems that NFop doesn't support the <fo:float> part of XSL-FO?

The below renders fine:

<fo:block>
  <fo:external-graphic src="c:\Projects\NFopSpike\NFopSpike\logo.jpg" />
  <fo:block>
    Foo
  </fo:block>
  <fo:block>
    Bar
  </fo:block>
</fo:block>

The below skips out the graphic completely:

<fo:block>
  <fo:float float="start">
    <fo:external-graphic src="c:\Projects\NFopSpike\NFopSpike\logo.jpg" />
  </fo:float>
  <fo:block>
    Foo
  </fo:block>
  <fo:block>
    Bar
  </fo:block>
</fo:block>

An alternative solution I'm using for now is to create a separate block container, that is absolutely positioned to where the floated image should appear, and ensure the other content isn't obscured, but a simple float would be much easier to maintain.

Was it helpful?

Solution

NFOP (latest release in March 2008) is a .NET port of Apache FOP (latest release in July 2010). Apache FOP has never supported fo:float (see http://xmlgraphics.apache.org/fop/compliance.html#fo-object-float).

So the answer to your question is: no, fo:float is unfortunately not supported.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top