Contents | < Miscellaneous Inline Elements | Appendix A - Colors >

Extensions

Index Entries

There are two main steps in creating indexes:

Marking

Use xf:key attribute for any element that can have an id. While an id should always be unique, xf:key values may not be unique. All occurences of a specific key will participate in generating the final index.

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" 
         xmlns:xf="http://www.ecrion.com/xf/1.0"> 
    ...
    <fo:block xf:key="keywords.lion.range" >
        <fo:inline xf:key="keywords.lion" >Lions</fo:inline>, along with the other 
            big cats such as tigers are in the genus Panthera.
            ...
        </fo:block>
        <fo:block>
            Some <fo:inline xf:key="keywords.lion" >lions</fo:inline> are nomadic.
        </fo:block>
</fo:root>

In the example above, there are two distinct key values: keywords.lion.range and keywords.lion. Please note that the string value of key attribute can be anything, but for clarity purposes, we use a dotted notation in the examples presented in this chapter.

Page Indexes

To insert a list of pages corresponding to a index key, use xf:page-index.

<xf:page-index xmlns:xf="http://www.ecrion.com/xf/1.0"/
    ref-key="string" 
    list-separator="string"
    range-separator="string"

				

list-separator represents the separator between non consecutive page numbers; the default value is ", ".

range-separator represents the separator between the first and last pages in a range; the default value is "-".

<fo:block>
    lions <xf:page-index ref-key="keywords.lion"/> 
</fo:block>
<fo:block start-indent="0.2in">
    range <xf:page-index ref-key="keywords.lion.range"/> 
</fo:block>
For the complete source code for this code example see "Tutorial/KeywordIndex.fo" located under XML Documents Samples/Tutorial folder.

In normal usage conditions, you would probabely generate the index in a XSL transformation.

For example, considering the following XML document:

<doc title="African Lion">
    <section title="Classification &amp; Range">
        <keyword>Lions</keyword>, along with the other big cats such as 
        <keyword>tigers</keyword>
        ... 
    </section>
</doc>

To automatically generate a list of keywords and their respective page index, you can use the following XSL template:

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:fo="http://www.w3.org/1999/XSL/Format" 
    xmlns:xf="http://www.ecrion.com/xf/1.0"
    xmlns:ms="urn:schemas-microsoft-com:xslt"
    xmlns:tt="samples-and-documentation"
    >
    <ms:script implements-prefix="tt" language="JScript">
        function toLower(str)
        {
               return str.toLowerCase();
        }
    </ms:script>
    <xsl:key name="kkey" match="//keyword" use="tt:toLower(string(text()))"/>
    <xsl:template name="GenerateIndex">
        <xsl:for-each select="//keyword">
            <xsl:sort select="." />
            <xsl:if test="generate-id(.) = generate-id(key('kkey', tt:toLower(string(.)))[1])">
                <fo:block>
                    <fo:inline text-transform="lowercase"><xsl:value-of select="." /></fo:inline> 
                    <xf:page-index>
                        <xsl:attribute name="ref-key">
                            <xsl:value-of select="tt:toLower(string(.))"/>
                        </xsl:attribute>
                    </xf:page-index>
                </fo:block>
            </xsl:if>
        </xsl:for-each>
     </xsl:template>
</xsl:stylesheet>
For the complete source code for this code example see "Tutorial/KeywordIndex.xml" and "Tutorial/KeywordIndex.xsl" located under XML Documents Samples/Tutorial folder.

Encryption

PDF documents can be encrypted, and permission sets can be applied at rendering time using xf:security XSL-FO extension.

<xf:security xmlns:xf="http://www.ecrion.com/xf/1.0"/ 
         owner-password="password" user-password="password"
         encryption-strenght="128 | 40"
         allow-printing="true | false"
         allow-modify-contents ="true | false"
         allow-copy="true | false"  
         allow-modify-annotations="true | false" 
         allow-fill-in="true | false"
         allow-screen-readers="true | false" 
         allow-assembly="true | false" 
         allow-degraded-printing="true | false" >

owner-password and user-password

There are two passwords that can be specified for a document: an owner password and a user password.

encryption-strength

Specifies the encryption strength: 128 or 40 bits. 128 bits is the default.

allow-printing

Print the document (possibly not at the highest quality level, depending on whether allow-degraded-printing  is also set).

  

allow-modify-contents

Modify the contents of the document by operations other than those controlled by allow-modify-annotations, allow-fill-in and allow-assembly.

  

allow-copy

Copy or otherwise extract text and graphics from the document by operations other than that controlled by allow-screen-readers.

 

allow-modify-annotations

Add or modify text annotations, fill in interactive form fields, and, if allow-modify-contents is also set, create or modify interactive form fields (including signature fields).

  

allow-fill-in

Fill in existing interactive form fields (including signature fields), even if allow-modify-annotations is not set.

allow-screen-readers

Extract text and graphics (in support of accessibility to disabled users or for other purposes).

allow-assembly

Assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if allow-modify-contents is not set.

   

allow-degraded-printing

When this is set (and allow-printing is set also), printing is limited to a low level representation of the appearance, possibly of degraded quality.

Metadata

There are two ways to include metadata in the PDF files generated by XF Rendering Server 2008:

a) Using xf:info for generic document information including author, name, subject and keywords data:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xf:info xmlns:xf="http://www.ecrion.com/xf/1.0">
        <xf:title>About Metadata</xf:title>
        <xf:author>Joe Doe</xf:author>
        <xf:subject>Example Metata Document</xf:subject>
        <xf:keywords>PDF XML XMP</xf:keywords>
    </xf:info>
    ...
</fo:root>

b) Using xf:meta for metadata described in RDF/XML (Resource Description Framework) format. 

xf:meta can contain one or many rdf:RDF nodes. For each node, the engine will create an XMP   (Extensible Metadata Platform) packet in the generated PDF file.

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xf:meta xmlns:xf="http://www.ecrion.com/xf/1.0">
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
            <rdf:Description about="" xmlns:my="http://www.mydomain.org/myschema/">
                <my:field>value</my:field>
                <my:my-collection>
                    <rdf:Bag>
                        <rdf:li>red</rdf:li>
                        <rdf:li>green</rdf:li>
                        <rdf:li>blue</rdf:li>
                    </rdf:Bag>
                </my:my-collection>
            </rdf:Description>
        </rdf:RDF>
    </xf:meta>
    ...
</fo:root>

In this example, we have defined a object containing a member (called "field") and a collection containing three items.

Adobe PDF promotes XMP as a common standard that every application that works with PDF embedded metadata must understand. XMP supports a subset of RDF/XML.  In addition XMP standardizes the definition, creation and processing of metadata by providing:

Digital Signatures

XF Rendering Server 2008 offers support for generating digital signatures in PDF output.

There are two types of signatures:

A digitally signed document can not be altered without invalidating the signature.

To generate an invisible signature:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0">
    <xf:signature 
        name="Dr. Joe Doe" location="Rockville, Maryland" reason="Prescription" 
        certificate-serial-number="58 e9 4c 55 00 00 00 00 00 0c" 
        certificate-issuer="Thawte CA"/>
    ...
</fo:root>

To generate a visible signature:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xf="http://www.ecrion.com/xf/1.0">
    <xf:signature 
        id="Sig1"
        name="Dr. Joe Doe" location="Rockville, Maryland" reason="Prescription" 
        certificate-serial-number="58 e9 4c 55 00 00 00 00 00 0c" 
        certificate-issuer="Thawte CA"/>
    ...
    <fo:block ref-signature="Sig1">Signature</fo:block>
</fo:root>

Notes:

To generate a self signed certificate:

To generate a certificate request to be submitted to a Certification Authority (Thawte, Verisign)

To install a certificate issued by a CA:

We recomend that you test using self signed certificates. If you also have a Windows Server computer you can setup your own CA and issue certificates to be used by XF.

You will need Acrobat 6.0 and higher to validate the signatures.

You will need Acrobat 7.0 or higher to validate signatures issued by a CA because Acrobat 6.0 will display an error message when a certificate chain is embedded in the signature.

Barcodes

XF Rendering Server 2008 offers support for drawing UPC-A, UPC-E, EAN-13, EAN-8, 2 of 5, 3 of 9, Postnet and DataMatrix barcodes.

<xf:barcode xmlns:xf="http://www.ecrion.com/xf/1.0"/ 
       value="upc code" type="AUTO|UPC-A|UPC-E|EAN-13|EAN-8|2OF5|3OF9|DATAMATRIX|POSTNET"
       bar-unit="length"
       include-checksum="boolean"
       draw-text="boolean"
       extended="boolean"
       encoding="ASCII|C40|TEXT|BASE256|NONE|AUTO"
       preffered-format="AUTO|C10x10|C12x12|etc."
       fo:content-width="length"
       fo:content-height="length"
       fo:content-scaling="non-uniform|uniform"
       fo:font="font"
       fo:padding="padding"
       fo:border="border"
       fo:color="color">

value


type

bar-unit


include-checksum


draw-text


extended


encoding

Encoding for DATAMATRIX codes.


preferred-format

  • AUTO
  • C10X10
  • C12X12
  • C14X14
  • C16X16
  • C18X18
  • C20X20
  • C22X22
  • C24X24
  • C26X26
  • C32X32
  • C36X36
  • C40X40
  • C44X44
  • C48X48
  • C52X52
  • C64X64
  • C72X72
  • C80X80
  • C88X88
  • C96X96
  • C104X104
  • C120X120
  • C132X132
  • C144X144
  • C8X18
  • C8X32
  • C12X26
  • C12X36
  • C16X36
  • C16X48

Preffered format for DATAMATRIX codes.


Normal formatting attributes (font, color) still apply, but they must be prefixed by the fo: namespace.

<fo:block>
    <xf:barcode value="075-67 816 4125" type="UPC-A" bar-unit="1px" 
                fo:font="7.5pt Arial" 
                fo:color="blue"
                fo:scaling="non-uniform" fo:content-height="50pt" 
                fo:border="1pt solid purple" fo:padding="10pt"/>
</fo:block>
For the complete source code for this code example see "Advanced/Barcodes.fo" located under XML Documents Samples folder.

The rendering result is displayed in the next figure.

Figure 1


The following is a DATAMATRIX example:

<xf:barcode value="Hello World" type="DATAMATRIX" encoding="ASCII" preferred-format="C20X20"/>
		

The rendering result is displayed in the next figure.

Figure 2

For the complete source code for this code example see "Barcodes-Datamatrix.fo" located under XML Documents Samples folder.

The following is a POSTNET example:

<fo:block>
    JOE DOE<fo:block/>
    101 Main Street<fo:block/>
    Anytown US 12345-6789<fo:block/>
    
    <xf:barcode xmlns:xf="http://www.ecrion.com/xf/1.0" value="12345678901" 
                type="Postnet"/>
</fo:block>
		

The rendering result is displayed in the next figure.

Figure 3

For the complete source code for this code example see "Barcodes-Postnet.fo" located under XML Documents Samples folder.

Extended Layout Elements

This section describes several extensions to standard XSL-FO elements like fo:table and fo:list-block. The purpose of these extensions is to provide aditional control over the generated output.

Continued Labels

Sometimes is necessary to display a "Continued from the previous page" text whenever a page break occurs:

Figure 4

This behaviour can be achieved using xf:continued-label element:

<fo:table-cell background-color="rgb(153,204,255)" font-weight="bold">
    <fo:block>Header
        <xf:continued-label xmlns:xf="http://www.ecrion.com/xf/1.0">
            (Continued)
        </xf:continued-label>
    </fo:block>
</fo:table-cell>
For the complete source code for this code example see "Table-Continued.fo" located under XML Documents Samples folder.

Repeated Table Cells

Sometimes is needed to repeat a table cell whenever a page break occurs. You can achieve this behaviour by setting the value of xf:repeat-on-page-break for the table cell to be repeated to true:

<fo:table-cell display-align="center" xmlns:xf="http://www.ecrion.com/xf/1.0"
               xf:repeat-on-page-break="true">
    <fo:block font-weight="bold">
        [table cell's content is repeated at every split]
    </fo:block>
</fo:table-cell>
<fo:table-cell>
    <fo:block>
        Normal cell spanned across multiple pages... 
    </fo:block>
</fo:table-cell>

As you can see in the code fragment below, the xf namespace must be declared (if not already declared on one of the parent elements). The rendering result is displayed in the next figure.

Figure 5

Our example uses two different page layouts to show that the layout of the repeated content is calculated individually every time a page break occurs.

For the complete source code for this code example see "Table-Repeated.fo" located under XML Documents Samples folder.

Alternative Layout Flow

XF Rendering Server provides several attributes for fo:list-block elements that help users achieve an alternative layout flow.

A common usage of this feature is the generation of catalogs with product items that swap images and textual descriptions.

Figure 6

 

Contents | < Miscellaneous Inline Elements | Appendix A - Colors >