DITA: Jump start pdf plugin for customized pdf output

[spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

As you know DITA-OT can convert collection of topics into various output format such as pdf,xhtml or webhelp. However, there is always a need to create pdf outputs with your company logo, specific header and footer, probably one that is matching with your corporate literature and website theme. You can achieve this by creating your own plugin.

Basically DITA-OT transforms DITA Topics Files into an intermediate format and then sends it to the fo processor to convert directly into the pdf format.

We can customize fo plugin to generate outputs as per our needs. However, one should never touch the original fo plugin but create one for own needs.

In the year 2008 Jarno Elovirta had written a tool to automate DTD and specialization generation. Later on it was converted into custom pdf plugin generator. Though it has few limitations I found it very useful as a starting point while creating your first pdf plugin. In other words, for creating the skeleton of pdf plugin.Here is a jump start tip for creating your own pdf plugin.

1. Open Jarno Elovirta’s PDF Plugin generator that is hosted at following url

https://dita-generator-hrd.appspot.com/pdf-plugin/

[/spb_text_block] [spb_single_image image=”9805″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.1″ width=”1/1″ el_position=”first last”] [spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

2. Click Next, Select page size, margins and columns as shown in the figure 1.2

[/spb_text_block] [spb_single_image image=”9807″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.2″ width=”1/1″ el_position=”first last”] [spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

3. Though It doesn’t have much detailed options to customize header and footer but you can select some for header content and other layout options as shown in the figure 1.3

[/spb_text_block] [spb_single_image image=”9809″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.3″ width=”1/1″ el_position=”first last”] [fullwidth_text alt_background=”none” width=”1/1″ el_position=”first last”]

4. Select style attributes as shown in the figure 1.4 and click Next.

[/fullwidth_text] [spb_single_image image=”9810″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” width=”1/1″ el_position=”first last”] [spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

Further, there is an option to setup cover page however, I recommend ignoring this selection. You may select the task labels checkbox. Remember we are just creating basic pdf plugin, once your basic plugin is ready there are more sophisticated ways to customize the cover page.

 

[/spb_text_block] [spb_single_image image=”9811″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.5″ width=”1/1″ el_position=”first last”] [spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

5. Finally, enter the Plugin ID and desired transtype.You may specificy the Plugin version too. Click Generate to download your newly created plugin.

[/spb_text_block] [spb_single_image image=”9812″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.5″ width=”1/1″ el_position=”first last”] [fullwidth_text alt_background=”none” width=”1/1″ el_position=”first last”]

6. Unzip your the downloaded plugin file and copy entire plugin folder into DITA-OT install folder’s plugins subfolder. My plugin’s downloaded and unzipped folder name is com.mycompany.website-ug.

7. Simply, place the folder at following location.

<DITA-OT_INSTALL_FOLDER>/plugins/com.mycompany.website-ug

8. Now, open custom.xsl from the following location to do some corrections.

<DITA-OT_INSTALL_FOLDER>/plugins/com.mycompany.website-ug/cfg/fo/xsl/custom.xsl

Select entire section under <!–cover–> as shown in the figure below and delete. Save the custom.xsl file.

[/fullwidth_text] [spb_single_image image=”9813″ image_size=”full” frame=”noframe” intro_animation=”none” full_width=”no” lightbox=”yes” link_target=”_self” caption=”Figure 1.6″ width=”1/1″ el_position=”first last”] [fullwidth_text alt_background=”none” width=”1/1″ el_position=”first last”]

9. Now, your custom pdf plugin is ready to generate pdf output.From the <DITA-OT_INSTALL_FOLDER> run startcmd.bat and enter the following command

[/fullwidth_text] [codesnippet pb_margin_bottom=”yes” width=”1/1″ el_position=”first last”]

java -jar lib/dost.jar /i:samples/taskbook.ditamap /outdir:./out /transtype:websiteUG

[/codesnippet] [spb_text_block pb_margin_bottom=”no” pb_border_bottom=”no” width=”1/1″ el_position=”first last”]

Go and check the out folder under the <DITA-OT_INSTALL_FOLDER> for generated pdf output. I hope that sharing this jump start tip for creating DITA-OT pdf plugin will help helpful so, later on you can explore more sophisticated customization.

[/spb_text_block]

Krishna Meet

Krishna Meet is a software scientist having core interest in analytical dashboards. Majority of her career span was into tech-writing and UX-design. However, she thrives by intersecting multiple skill-sets : SQL & NOSQL databases, business analysis, and UX design. She is a voracious reader and possesses Masters degree in Computer Science. Her interest in agile methodologies and user-centered design has landed her a techno-functional role at Brevitaz.

All author posts
Write a comment