Example: Using Overlays

Top Previous Topic Next Topic  Print this topic

An overlay can be specified using the xfj:overlay element. To place overlays on selected documents, it is recommended to specify an id attribute for each xfj:document.

 

Note:

·Document IDs are case-sensitive and will only function when placed on the xfj:document element.

 

Building upon the previous example, the Overlay.fo document will be added to the DAL job. It will be displayed above all the documents used in the job.

 

 

The new file will add a header to every document in the job, writing the current page number and total page count of the output document.

 

Notes:

·Overlays need the z-index attribute to specify where they are to be positioned relative to the document's content and to other overlays. In this case, the overlay will be above because the z-index attribute's value is positive.
·Overlays need a set of rules which tell the DAL engine where they should and should not be displayed. In this case, the overlay will appear over all the documents.

 

The DAL job file for this example will be the following:

 

 

<?xml version="1.0" encoding="utf-8"?>

<xfj:job xmlns:xfj="http://www.ecrion.com/xfj/1.0">

       <xfj:output mime-type="application/pdf"/>

       <xfj:overlay id="Header" z-index="1">

               <xfj:apply-rules>

                       <xfj:match rule="all" />

               </xfj:apply-rules>

               <xfj:external-content src="url(Overlay.fo)" />

       </xfj:overlay>

       <xfj:document id="doc2" title="Current Superannuation">

               <xfj:external-content src="InputPDF.pdf"/>

       </xfj:document>

       <xfj:document id="doc3" title="your Funds">

               <xfj:apply-local-template src="InputXFD.xfd"/>

               <xfj:external-content src="data.xml"/>

       </xfj:document>

</xfj:job>

 

 

All the referenced file can be found in the XML Samples folder, available after installing XF Rendering Server.