Skip to content

Developing a PDF Plugin with oXygen

Steven Higgs edited this page Dec 20, 2016 · 4 revisions

This topic contains some tips for developing a PDF customization plugin with oXygen XML Editor.

Display the PDF transformation output console

In oXygen XML Editor, the PDF transformation output console is hidden by default because the majority of users are not interested in the information displayed there. However, if you want to analyze how the PDF plugin works, this console contains useful information. You can choose to display this console by going to Options/Preferences/DITA and selecting Always for the Show Console Output option.

PDF console

Detect and set XSLT master files for the PDF plugin

The majority of PDF customizations are made by extending an XSLT transformation associated with the transform.topic2fo.main processing step. This means that you will create set of XSLT files whose templates will overwrite templates from the default XSLT transformation.

When you are editing these extension stylesheets, it is important to keep them valid. Also, it might be useful for the content completion to present all of the global variables and parameters that you can use.

To achieve this in oXygen XML Editor, you need to specify which files are the main stylesheets for the PDF plugin. This can be done by using the Master Files support. Right-click the org.dita.pdf2 folder from the Project view (it is called Navigator in Eclipse) and use the Detect Master Files contextual menu action. After the detection is complete, the application will present a list of possible master files that you can choose from. It is important that you don't select the stylesheets with a _template.xsl prefix because they are not valid. They are XSLT template files used by the DITA-OT Integrator tool.

Add the XML Catalog from PDF customization in oXygen

The XML Catalog from a PDF customization is used to redirect the URLs within the PDF plugin to the resources included in your customization. Below, you can see how the cfg:fo/attrs/custom.xsl URI is redirected to the fo/attrs/custom.xsl stylesheet from a customization.

<!-- Custom attributes entry -->
<uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>

<!-- Custom XSL code entry.-->
<uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>

For more details about this mechanism, see the PDF plug-in structure topic from the DITA-OT documentation.

In oXygen XML Editor, you can specify the XML Catalog for a PDF customization (Customization/catalog.xml) in Options/Preferences/XML/XML Catalog.