Skip to main content

 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 usage.

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 maven central .

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 processYes
destPath to the destination file. If unspecified, the default value is the name and location of the source with .pdf extensionNo
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 is created under the working folderNo

Elements

<config>

Defines a config file which overrides rules in the default config file. There might be multiple <config> elements.

AttributeDescriptionRequiredDefault
filePath to a configuration fileYes
nameUse default to apply the rules to all, or else specify the name of a PSML document type.Nodefault
priorityThe priority number for the rules in this config file. When there are multiple files, higher priority overrides lower.No1

<configs>

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

AttributeDescriptionRequiredDefault
folderPath to a configuration folderYes
priorityThe priority number for the rules in these config files. When there are multiple files, higher priority overrides lower.No1

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:

Loads the config files.

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

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

Created on , last edited on