In addition to rendering XML and XHTML styled with CSS, PDFreactor is also able to render documents with compound formats such as images, SVG and barcodes. The images, SVG and and barcodes are handled by separate formatters within PDFreactor, so-called "replaced element" formatters.
The replaced element formatters can be mapped to arbitrary elements using styles.
You can use namespaces to include other document formats to integrate XML elements from a different namespace directly within your document.
PDFreactor supports the "img" element per default in XHTML. For other XML languages, you can use proprietary CSS extensions to define an image element. For example, in an XML vocabulary where an image element is "<image source='test.jpg'>", the corresponding CSS definition would be:
image {
-ro-replacedelement: 'com.realobjects.xml.formatters.ImageFormatter';
-ro-source: attr(source);
}To define an element as image element, you must specify the replaced element formatter for images for this element, as displayed in the example above. Using the "-ro-source" property, you can select an attribute of this element. The value of this attribute must always be of the type URI and is used to load the image.
PDFreactor supports the image formats PNG, JPG and GIF.
PDFreactor automatically embeds and renders Scalable Vector Graphics (SVG) documents referenced via the img element. Example:
<img src="diagram.svg" />
Alternatively, you can embed SVG directly into your documents using namespaces:
a circle:<br/>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg"
width="100" height="100" xmlns="http://www.w3.org/2000/svg">
<svg:circle cx="50" cy="50" r="45" fill="yellow" stroke="black" />
</svg:svg>
<br/>sometext.......To enable this feature add the following lines to your style sheet:
@namespace svg url(http://www.w3.org/2000/svg);
svg|svg
{
-ro-replacedelement: 'com.realobjects.xml.formatters.SVGFormatter';
}PDFreactor uses Apache Batik to render SVG.
PDFreactor supports displaying barcodes in documents using the Barcode XML format from Barcode4J:
<p><b>EAN-13:</b></p>
<barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns"
message="123456789012">
<barcode:ean-13/>
</barcode:barcode>
<br>sometext.......To enable this feature add the following lines to your CSS style sheet:
@namespace barcode url(http://barcode4j.krysalis.org/ns);
barcode {
-ro-replacedelement: "com.realobjects.xml.formatters.BarcodeFormatter";
}PDFreactor supports displaying MathML in documents using the MathML XML format.
<math mode="display">
<mrow>
<munderover>
<mo>∫</mo>
<mn>1</mn>
<mi>x</mi>
</munderover>
<mfrac>
<mi>dt</mi>
<mi>t</mi>
</mfrac>
</mrow>
</math>
To enable this feature add the following lines to your CSS style sheet:
math {
-ro-replacedelement: "com.realobjects.xml.formatters.MathMLFormatter";
}Java 1.5 or higher is required to use this feature.
PDFreactor supports the "object" and "embed" elements of XHTML. You can use either element or a combination of both to embed any type of data such as for example a flash animation. The most simple code to do so is:
<embed src="myflash.swf" width="256" height="256"
type="application/x-shockwave-flash"/>Besides flash you can also embed various other formats, e.g. movies. The data is automatically embedded in the PDF, but whether or not it is displayed depends on the formats supported by your PDF viewer.