Publishing

Publishing PageSeeder data to print, the Web or both

Task export-pdf

This task can be used to convert a portable or processed PSML document to PDF according to rules in the PDF Export Config.

To use this Ant extension standalone outside PageSeeder you can download the pso-pdf-ant-x.jar and pso-pdf-core-x.jar files from bintray .

Definition

Minimal definition:

<export-pdf src="[source]" />

 Full definition:

<export-pdf
    src="[source]"
    dest="[destination]"
    working="[working-directory]"
    debug="true|false">
  <config
    file="[config file]"
    name="[document type]"
    priority="[priority number]"/>
  <configs
    folder="[config folder]"
    priority="[priority number]"/>
</export-pdf>

Attributes

AttributeDescriptionRequired
@srcPath to the .psml source file to process.Yes
@destPath to the destination file. If unspecified, the default value is the name and location of the source with .pdf extension.No
@working

The directory holding temporary files such as the concatenated configs files and XSL-FO scripts. The default is:

[java.io.tmpdir]/antpdf-[number]
No
@debugIf "true" an fo.xml file will be created under the working folder.No

Elements

<config>

Defines a config file which will override rules in the default config file. There maybe be multiple <config> elements.

AttributeDescriptionRequired
@filePath to a configuration file.Yes
@nameUse default to apply the rules to all, or else specify the name of a PSML document type. Default value is "default".No
@priorityThe priority number for the rules in this config file. When there are multiple files, higher priority will override lower. Default value is "1".No

<configs>

Defines a set of config files which will override rules in the default config file. There maybe be multiple <configs> elements. Any config files with the following path will be read [config folder]/[document type]/pdf-export-config.xml

AttributeDescriptionRequired
@folderPath to a configuration folder.Yes
@priorityThe priority number for the rules in these config files. When there are multiple files higher priority will override lower. Default value is "1".No

Usage

Invoking in Ant

This task is included by default in the PageSeeder publisher so <taskdef/>  is only required when using it outside the publisher.

<project ... xmlns:psp="antlib:org.pageseeder.pdf.ant">

  <!-- only required for standalone -->
  <taskdef uri="antlib:org.pageseeder.pdf.ant" 
      resource="org/pageseeder/pdf/ant/antlib.xml" 
     classpath="pso-pdf-ant-0.2.2.jar"/>

  <target ... >
    <!-- Invoke Task -->
    <psp:export-pdf src="test.psml" dest="result.pdf"/>
  </target>
</project>

Using a namespace is not required, but it is a good mechanism to know the origin of the task. The recommended namespace is 'psp'.

Standalone

Because it is designed to work as a standalone process, no connection to PageSeeder is required. However, when run in the context of a PageSeeder export, use the Task export and Task process to download the source PSML file.

How does it work?

This Ant task will:

Load the config files.

Create XSL-FO according to the rules in the config files and the default config.

Use Apache FOP to generate the PDF output from the XSL-FO.

Created on , last edited on