Guide

The end-user manual for PageSeeder

 

PSML Ant scripts

The build.xml Ant script files on the Publish Engine are used to import, export, publish and process PSML documents.

These files can be accessed by clicking on Project Files on the right side of the Dev > Toolbox page and must be created in the following folder:

[project]/[source type]/[source extension/][action type]/build.xml

or for scripts specific to a PSML document type:

[project]/psml/[document type]/[action type]/build.xml

where project must be the same project that the publish-config.xml or document-config.xml files are under.

Examples

myproject/document/psml/export/build.xml
myproject/document/docx/upload/build.xml
myproject/folder/publish/build.xml
myproject/group/export/build.xml
myproject/psml/mytype/publish/build.xml

Details

PSML Ant scripts have the following differences with PS standard scripts:

  1. There should be no references to the ant-library which was designed to work with PS standard files.
  2. They do not need to clear the working folder is it is now cleared automatically before the script is run.
  3. They should not use the Ant <input> task to access user parameters. These are now automatically available to the script using ${ps.param.[name]}.
  4. They should not reference PageSeeder properties using ${ps-*}. These should be referenced using using ${ps.config.default.*}.
  5. They should primarily only use the following PageSeeder Ant tasks and the only configuration required is <project ... xmlns:ps="antlib:com.pageseeder.external.ant"> :
    1. Task config
    2. Task export
    3. Task process
  6. They may also use the following Ant extensions which are now included in the Publish Engine lib so only require the following configuration <project ... xmlns:psd="antlib:com.pageseeder.ant.docx" xmlns:psp="antlib:com.pageseeder.ant.pdf"> :
    1. ps-ant-docx
    2. ps-ant-pdf

Example

The example below exports a PSML document to PDF format.

<project name="document-psml-export" 
    xmlns:ps="antlib:com.pageseeder.external.ant"
    xmlns:psp="antlib:com.pageseeder.ant.pdf">

  <target name="create-consolidated-pdf" description="Create PDF Document">
    
    <ps:config />
   
    <property name="download" value="${ps.config.default.working}/download" />
    <property name="process" value="${ps.config.default.working}/process" />
    <property name="temp" value="${ps.config.default.working}/temp" />
    <mkdir dir="${download}"/>
    <mkdir dir="${process}"/>
    <mkdir dir="${temp}"/>

    <echoxml><progress percent="1" /></echoxml>  
    
    <ps:export src="${ps.config.default.uri.path}" dest="${download}" 
        xrefdepth="${ps.param.depth}">
      <xrefs types="replace,embed,transclude"/>
    </ps:export>
          
    <echoxml><progress percent="50" /></echoxml>

    <ps:process src="${download}" dest="${process}" 
        generatetoc="${ps.param.toc}">
      <xrefs includes="${ps.config.default.uri.filename.no.ext}.psml"
        types="embed,transclude"/>
      <number numberconfig="defaultNumberingConfig.xml"  />
    </ps:process>
 
    <echoxml><progress percent="80" /></echoxml>
   
    <psp:pdf-export
      src="${process}/${ps.config.default.uri.filename.no.ext}.psml"
      dest="${ps.config.default.working}/${ps.config.default.uri.filename.no.ext}.pdf"
      working="${temp}"/>

    <copy
      todir="${ps.config.default.web.root}/session/${ps-sessionfolder}${ps-groupFolderNoPrefix}/export"
      file="${ps.config.default.working}/${ps.config.default.uri.filename.no.ext}.pdf" />
        <echoxml>
      <displayUriPath>${ps.config.default.engine.url}/session/${ps.config.default.session.folder}${ps.config.default.group.folder.no.prefix}/export/${ps.config.default.uri.filename.no.ext}.pdf</displayUriPath>
    </echoxml>
  </target>
</project>

Created on , last edited on