XSL-FO is a primary input format for XML2PDF Formatting Engine. Being properly designed it covers most of the publishing workflow requirements. Yet, there are some special PDF features that are missing in the XSL-FO specification. Altsoft does its best to cover the customers’ needs and provide some extensions to XSL-FO format syntax.

Namespace

All extensions are defined in the namespace “altsoft:”. To use any of the Altsoft extensions, add a namespace entry for http://www.alt-soft.com/products/xml2pdf-formatting-engine/ either to the root element or to any parent element:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" 	xmlns:altsoft="http://alt-soft.com/xml2pdf/extensions">      

Extensions

PDF Layers

Generating multi-layer PDF documents using XSL-FO z-index attribute

You can generate multi-layer PDF documents using the XSL-FO z-index attribute as a layer ID. To convert all XSL-FO elements with a fixed z-index value to a PDF layer, use the <altsoft:z-index-to-layer-assignment> tag inside the XSF-FO declarations section.

XSL-FO

DTD:
<!ELEMENT z-index-to-layer-assignment EMPTY>
<!ATTLIST z-index-to-layer-assignment
z-index-level CDATA #REQUIRED
level-name CDATA #REQUIRED
show-state (true|false) #IMPLIED>

z-index-level – the layer number defining all layer objects via the XSL-FO z-index property;
level-name – the layer name to be used by the Acrobat Layers panel;
show-state – initial state of the layer. Use the true value if you want it to be visible (printable) and false if vise versa. Possible values:

  • true – the layer is visible for both print and view (default)
  • false – the layer is invisible for print and view
  • view:[true|false];print:[true|false] – separate settings for view and print

This tag must be the first level descendant of the <fo:declarations> element.

For example, to create a layer from all objects having z-level=”101″, use the following declaration:
<fo:declarations xmlns:altsoft="http://alt-soft.com/xml2pdf/extensions">
...
<altsoft:z-index-to-layer-assignment
z-index-level="101"
level-name="Answers"
show-state="false" />
...
</fo:declarations>

Altsoft XML2PDF Formatting Engine supports z-index attribute in <fo:block-container> and <fo:inline-container> elements:

<fo:inline-container z-index="10">
	<fo:block>Albert Einstein</fo:block>
</fo:inline-container>

PDF Attachments

PDF format allows embedding any files into the PDF file. These files can be opened via Document item ->File Attachments… inside Adobe Acrobat 6.0+ or Adobe Reader. To embed any file into the generated PDF document produced by Altsoft XML2PDF Formatting Engine, use the <altsoft:attachment> tag inside the XSL-FO declarations section.

PDF format allows embedding any files into the PDF file. These files can be opened via the Document item ->File Attachments… inside Adobe Acrobat 6.0+ or Adobe Reader. To embed any file into the generated PDF document produced by Altsoft XML2PDF Formatting Engine, use the <altsoft:attachment> tag inside the XSL-FO declarations section.

XSL-FO

DTD:
<!ELEMENT attachment EMPTY>
<!ATTLIST attachment
src CDATA #REQUIRED
name CDATA #IMPLIED
description CDATA #IMPLIED>

src – URI of the file to be attached;
name – attachment name to be used by Adobe Acrobat. By default this is just the local file name;
description – description of the file to be shown by Adobe Acrobat next to the attachment.

This tag must be the first level descendant of the <fo:declarations> element.

For example, to attach the source XSL-FO file to the output PDF document use the following declaration:
<fo:declarations xmlns:altsoft="http://alt-soft.com/xml2pdf/extensions">
...
<altsoft:attachement
src="hello-world.fo"
name="Source XSL-FO file" />
...
</fo:declarations>

PDF Document Properties

PDF format allows setting properties of the PDF file. They can be opened via File item ->Document Properties… inside Adobe Acrobat or Adobe Reader. To embed any property into the generated PDF document produced by Altsoft XML2PDF Formatting Engine, use the <altsoft:document-properties> tag inside the XSL-FO declarations section.

PDF format allows setting properties of the PDF file. They can be opened via the File item->Document Properties… inside Adobe Acrobat or Adobe Reader. To embed any property into the generated PDF document produced by Altsoft XML2PDF, use the <altsoft:document-properties> tag inside the XSL-FO declarations section.

XSL-FO

DTD:
<!ELEMENT document-properties (author?,subject?,keywords?,custom*)>

<!ELEMENT author EMPTY>
<!ATTLIST author
value CDATA #REQUIRED>

<!ELEMENT subject EMPTY>
<!ATTLIST subject
value CDATA #REQUIRED>

<!ELEMENT keywords EMPTY>
<!ATTLIST keywords
value CDATA #REQUIRED>

<!ELEMENT custom EMPTY>
<!ATTLIST custom
name CDATA #REQUIRED
value CDATA #REQUIRED>

This tag must be the first level descendant of the <fo:declarations> element.

For example:

<fo:declarations xmlns:altsoft=""http://alt-soft.com/xml2pdf/extensions">
  <altsoft:document-properties>
    <altsoft:author value="Victor Vishnyakov"/>
    <altsoft:subject value="Adding Document Properties to PDF file"/>
    <altsoft:keywords value="PDF XSL-FO document properties"/>
    <altsoft:custom name="Related Product" value="Altsoft XML2PDF"/>
  </altsoft:document-properties>
</fo:declarations>