I am using DITA-OT 3.6.1, and I am trying to create a DITA-OT plugin to customise PDF production. I understand that plugins are now the preferred approach.
Ultimately I want two plugins, one for setting basic properties, e.g. Page Size, some formatting options, etc, and then another which may need to override some XSL:FO to do some custom formatting.
To get started, I am trying to very simply to create a PDF plugin that just sets args.chapter.layout to BASIC.
I have read the DITA-OT docs a few times, but somehow I haven't found a good example with details of actually how to use it in practice.
My plugin.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="uk.gov.nationalarchives.omega.dita-ot.pdf-settings">
<require plugin="org.dita.pdf2"/>
<transtype name="print-pdf" extends="pdf" desc="PDF on A4 paper"/>
<feature extension="dita.transtype.print" value="print-pdf"/>
<feature extension="ant.import" file="integrator.xml"/>
</plugin>
My integrator.xml looks like:
<?xml version='1.0' encoding='UTF-8'?>
<project name="uk.gov.nationalarchives.omega.dita-ot.pdf-settings">
<target name="dita2draft.pdf.init">
<!-- Disable the subsection links on the first page of each chapter -->
<property name="args.chapter.layout" value="BASIC"/>
</target>
<target name="dita2draft.pdf" depends="dita2draft.pdf.init, dita2pdf2"/>
</project>
I have placed plugin.xml and integrator.xml into a Zip file and installed them into DITA-OT using:
dita install file:/tmp/uk.gov.nationalarchives.omega.dita-ot.pdf-settings.zip
I see it when I run `dita plugins`:
❯ dita plugins
org.dita.base
org.dita.eclipsehelp
org.dita.html5
org.dita.htmlhelp
org.dita.index
org.dita.normalize
org.dita.pdf2
org.dita.pdf2.axf
org.dita.pdf2.fop
org.dita.pdf2.xep
org.dita.specialization.dita11
org.dita.xhtml
org.lwdita
org.oasis-open.dita.techcomm.v2_0
org.oasis-open.dita.v1_2
org.oasis-open.dita.v1_3
org.oasis-open.dita.v2_0
org.oasis-open.xdita.v0_2_2
uk.gov.nationalarchives.omega.dita-ot.pdf-settings
If I run:
dita --verbose --input=/tmp/ocdm.ditamap --format=pdf --output=/tmp/out
I do get a PDF, but my plugin doesn't appear to have done anything at all.
If I try instead running:
dita --verbose --input=/tmp/ocdm.ditamap --format=print-pdf --output=/tmp/out
I get the errors:
Searching for integrator.xml ...
init:
Error: The following error occurred while executing this line:
Target "dita2print-pdf" does not exist in the project "DOST".
To be honest I am not really sure what I am meant to do, am I meant to define `dita2print-pdf` somewhere and if so, why, and what do I need to put there?
Any help on getting started (in-practice) would be appreciated...
Thanks Adam.