During the lab, you will override the existing Pipeline Transformers beans
on top of a new Pipeline Definition, in order to use your custom DITA OT PDF
output when Alfresco generates previews.
-
In your project, locate the
src/main/resources/META-INF
folder.
This folder let you override some existing Spring framework beans for existing modules.
You will override some beans of the componize-dita module.
-
Open the
context.xml
file in your favorite editor.
-
Create a new DITA OT Pipeline Definition bean.
-
Add the following properties to the DITA OT Pipeline Definition bean as
required. You will want to add the transtype option in order to use your
custom PDF plugin:
Property |
Type |
Mandatory |
Description |
resultMediaType
|
MediaType |
Required |
The MediaType of the result document that will be generated by this pipeline.
E.g. text/xml, application/pdf... |
options
|
Map <QName,String> |
Optional |
The default options with default values for the pipeline. These options will be passed directly to
the XProc pipeline. Use a fully-qualified name with Clark notation as the key of the entry. |
<bean id="ditaot.pipelineDefinition.pdf-custom" parent="ditaot.pipelineDefinition.abstract">
<property name="resultMediaType" ref="pdf.mediaType" />
<property name="options">
<map>
<entry key="transtype" value="custom-pdf" />
</map>
</property>
</bean>
-
Override the existing Pipeline Transformer beans for DITA topic and
maps to point to your custom pipeline definition. Those beans id are
dita.transformer.pipeline.map2pdf2 and
dita.transformer.pipeline.topic2pdf2
Property |
Type |
Mandatory |
Description |
pipelineDefinition
|
PipelineDefinition |
Required |
The pipeline definition to execute for the transformation |
mediaType
|
MediaType |
Required |
The MediaType of the result document that will be generated by this pipeline. E.g. text/xml, application/pdf... |
xmlSchemaFilter
|
XmlSchemaFilter |
Required |
A XmlSchemaFilter for the source document. This will be used to determine if a
given source document is valid for (can be processed by) this transformer. |
<bean id="dita.transformer.pipeline.map2pdf2" parent="xml.transform.PipelineTransformer.abstract">
<property name="pipelineDefinition" value="ditaot.pipelineDefinition.pdf-custom" />
<property name="mediaType" ref="pdf.mediaType" />
<property name="xmlSchemaFilter" ref="dita.schemas.map" />
</bean>
<bean id="dita.transformer.pipeline.topic2pdf2" parent="xml.transform.PipelineTransformer.abstract">
<property name="pipelineDefinition" value="ditaot.pipelineDefinition.pdf-custom" />
<property name="mediaType" ref="pdf.mediaType" />
<property name="xmlSchemaFilter" ref="dita.schemas.topic" />
</bean>
-
Save your changes.
-
Deploy your files to the application server.
DITA files should now use your custom PDF output for their Document Library
previews.