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 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 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">
<svg:circle cx="50" cy="50" r="45" fill="yellow" stroke="black" />
</svg:svg>
<br/>sometext.......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.......PDFreactor supports displaying MathML in documents using the MathML XML format.
<math:math mode="display" xmlns:math="http://www.w3.org/1998/Math/MathML">
<math:mrow>
<math:munderover>
<math:mo>∫</math:mo>
<math:mn>1</math:mn>
<math:mi>x</math:mi>
</math:munderover>
<math:mfrac>
<math:mi>dt</math:mi>
<math:mi>t</math:mi>
</math:mfrac>
</math:mrow>
</math:math>
Java 1.5 or higher is required to use this feature.
PDFreactor supports displaying QR codes in documents using the following style:
.qrcode {
-ro-replacedelement: 'com.realobjects.xml.formatters.QrCodeFormatter';
}If the replaced element is applied to an HTML link, the reference URL (resolved against the base URI) is used as the content of the QR code, e.g.:
<a href="http://www.realobjects.com" class="qrcode"></a>
In any other case the text content of the element is used, e.g.:
<span class="qrcode"> BEGIN:VCARD VERSION:2.1 N:Doe FN:John TEL:+1-555-123-456 TEL;FAX:+1-555-123-457 EMAIL:johndoe@johndoe.com URL:http://www.johndoe.com END:VCARD </span>
QR Codes can be tweaked using the following CSS properties:
-ro-qrcode-errorcorrectionlevel: Sets the error correction level of the QR code. Possible values are "L"(default), "M", "Q" and "H".
-ro-qrcode-quietzonesize: Sets the size of the quiet (empty) zone around the QR code in modules (QR code "square" widths). The default value is 1. Possible values are 0 (no quiet zone) and positive integers.
-ro-qrcode-forcedcolors: By default QR codes ar black on white. When setting this property to "none", the CSS properties "color" and "background-color" are used instead.
-ro-qrcode-quality: By default The QR code is built from multiple squares. This method is fast and looks correct in print. However, in PDF viewers on screen the edges of neighboring squares may be visible. When setting this property to "high" the squares are combined into one object, ensuring a seamless look, at the cost of performance.
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.