Export PDF (XSLT)

Prev Next

Module Configuration


Locations: 

  • Site Configuration > User Settings > Access Rights;

  • Site Configuration > Module Configuration > Settings.

    In order to be able to use the 'Manual Export PDF (XSLT)' feature  — the following conditions should be adhered to:

  • The corresponding access right ('Manual Export PDF (XSLT)') should be enabled to a module:

    Settings interface displaying options for manual PDF export and various application rules.

    Manual Export PDF (XSLT) in Access Rights

  • The 'Manual Export PDF (XSLT)' setting should be enabled in the corresponding module Settings:

    Settings for exporting PDF and using external templates in a module interface.

    Manual Export PDF (XSLT) in Module settings

These settings define the primary behavior and appearance of the export button.

Feature

Description

Enable manual Export PDF (XSLT)

A checkbox to turn the feature on or off for the specific context.

Label on Export PDF (XSLT) Button

Allows to customize the button label (e.g., "Generate Catalogue") that users see in the Item and Module views.

These settings manage how and where files are stored when a user selects the "Save File to Current Item" property.

Feature

Description

Activate Save Exported PDF (XSLT)

Enables the "Save" choice in the export menu.

Save PDF (XSLT) to Current Item

When selected, the created file is directly linked to the record currently being viewed.

Save to Module

Specifies the module where the saved file will go.

Note: Only current module is supported

Store Exported PDF (XSLT) in

Indicates the specific field within the item where the PDF will be kept.

These settings define how the system fetches the XSLT templates used for the PDF generation.

Feature

Description

Use External Module for Templates

Designates a specific module  as the library for available PDF layouts.

Template Name

Specifies which field in the external module holds the name of the template.

File Field

Identifies the file fields used to generate the actual file content and the visual preview.

Filter Field

Specifies which optional field within the external module contains the filter settings to determine which items will be recognised as print templates.

Output File Name

A text field used to define the naming convention for the final generated PDF. Output File Name should be without file extension. Accepts Velocity Engine.

Note: The Output File Name set in Print Templates is overwritten if a file name is also inserted in the Module Settings (which is only possible when an External Module is enabled).

Following these conditions will enable the displaying of the button with the corresponding Label in the Item Information window, so user will be able to download item information in PDF format. If it is necessary to save generated PDF file to other module — please select the Save Exported PDF (XSLT) to Module checkbox and map corresponding Module, File Field and Field Template to be used (as it is shown in the screenshot above)

Templates Configuration and Usage


Location: Site Configuration > Module Configuration > Print Templates

To customize exported PDF xslt is used. First you need to know the xml that will be used. When Export to PDF is configured — in any view navigate to the Item that contains all required fields (from the referencing items either) and download PDF with selected template via Export to PDF.

Menu options for managing files, including generating a catalogue and downloading files.

Export PDF option for the Item

Feature

Description

Download File

This allows the user to generate the PDF and download it directly to their local machine. If only one template is available, the download begins immediately; if more than one exists, the user is prompted to select a template first.

Save File to Current Item

This feature saves the generated PDF directly to the current item's records. It is enabled via the "Save PDF (XSLT) to Current Item" setting and stores the file in a designated field, such as "Saved PDF".

Download Source

This option allows the admin users only to download the underlying source data used to generate the PDF.

Preview Templates

This launches the preview process for all available templates. This triggers a background job that, once complete, automatically opens a preview window for review or allows the user to open it later from the background jobs queue.

Now we have example of xml output as in the example below:

<?xml version="1.0"?>
<printedItem>
	<item id="24" moduleId="115">
		<fields>
			<field id="1078">
				<name>Name Field</name>
				<value>Gold Giraffe</value>
			</field>
			<field id="1248">
				<name>Price </name>
				<value>32.453,00</value>
			</field>
		</fields>
	</item>
	<referringItems>
		<item id="110" moduleId="20">
			<fields>
				<field id="242">
					<name>MediaFile</name>
					<value>Giraffe.png</value>
				</field>
				<field id="1097">
					<name>Size</name>
					<value>Large</value>
				</field>
				<field id="1106">
					<name>Product</name>
					<value id="24">Gold Giraffe</value>
				</field>
			</fields>
		</item>
		<mediaHolders>
			<mediaHolder mediaHolderId="29" moduleId="20">
				<name>MediaFile</name>
				<file fileUrl="/worker/servlets/unsecuredDownloadDelegator?path=...."/>
			</mediaHolder>
			<mediaHolder mediaHolderId="30" moduleId="20">
				<name>PDF Template</name>
			</mediaHolder>
			<mediaHolder mediaHolderId="31" moduleId="20">
				<name>Preview 100</name>
				<file fileUrl="/worker/servlets/unsecuredDownloadDelegator?path...."/>
			</mediaHolder>
		</mediaHolders>
	</referringItems>
</printedItem>

So let's get back to the Site Configuration > Module Settings > Print Templates configuration and create New Template. For example we need all fields and images from the referencing items to be printed. HTML mark-up can be used to make preview look nice, but we will avoid this part. The example below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml"/>
	<xsl:template match="/">
		<html>
			<head>
				<style>body {font-family: arial;}</style>
			</head>
			<body>
				<table border="1">
					<tr>
						<th>Field name </th>
						<th> Field value</th>
					</tr>
					<xsl:for-each select="printedItem/item/fields/field">
						<tr>
							<td>
								<xsl:value-of select="name"/>
							</td>
							<td>
								<xsl:value-of select="value"/>
							</td>
						</tr>
					</xsl:for-each> 
				</table>
				<img src="{printedItem/referringItems/mediaHolders/mediaHolder[@mediaHolderId='285']/file/@fileUrl}" width="100" hight="100" hspace="1"/>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

As you can see from the example above we will get all fields from current item and image from the reference items that is hold in Preview 100 media holder and has id=31. So as the result we will have next PDF:

image350.png

Fig.5.: Result of Exported PDF