The Java Report Generator by Big Faceless Organization (BFO) is a commercial java library that converts XML into PDF documents. I have been using it for several months now and here are some quirks that I have came across so far:
- XML is not HTML, some characters and tags are not compatible and here are the workarounds I use.
- First element in a DIV must be a tag and not a text.
| HTML | XML |
| |   |
| <br> | <br/> |
| <font face=”Helvetica size=”12pt”>text</font> | use <span style=”font: normal 12pt Helvetica;”>text</span> |
| bgcolor attribute | use CSS background-color |
| TABLE border attribute | use TABLE cellborder attrbute |
| tags can overlap e.g. <b><i>text</b></i> | tags can not overlap e.g. <b><i>text</i></b> |
<pdf>
<body>
<div>text</div> <!-- this throws an error -->
</body>
</pdf>
must be
<pdf>
<body>
<div><span/>text</div> <!-- workaround: place an empty span -->
</body>
</pdf>
<p style="page-break-after:avoid;">
<!-- some text here -->
</p>
<p style="page-break-after:avoid;"> <!-- the two p tags will be clustered together! -->
<!-- some text here -->
</p>
must be
<p style="page-break-after:avoid;">
<!-- some text here -->
</p>
<span/> <!-- workaround: put empty span to separate the two p tags -->
<p style="page-break-after:avoid;">
<!-- some text here -->
</p>
Advertisement