Page 1 of 1

Ask a suppor to share the logic of customize PDF transformation

Posted: Tue Jul 11, 2017 9:50 am
by lisazeng
Hi Oxygen expert,

My tools: Dita OT2.5

I have download your pdf plugin and test it successfully.
Then I want to update your plugin for PDF transfor mation
. Add footer and header
. Add new cover page , first page and last page.
.format the pragraph, table and other elements of PDF.

What I understand now:
In Customization
-----fo
---attrs (includes attributes xls files)
---xsl ( includes how to transform attributes)


For example, if i want to change the header and footer, i need to rewrite the static-content-attr.xsl in attrs folder and static-content.xsl in xsl folder. of course I need to added them in the seperate custom.xsl.
My question comes:
1. how do I know which xsl i need to rewrite in attr and xsl folder? their name and their content. doese this mean I need to copy some file from somewhere?

2. how do I know which part should be rewrite? for example, in static-content.xsl , there are several templates about oddfooter, evenfooter, indexfooter and others. How should I know which one is used for what?

3. if it is possible, as I mentioned in above, to achieve these functions, which xls should I rewrite and what content should I rewrite?
I really want to understand the logic of how to customize the pdf output as I tried to use it for next pdf publicaion, which might come in 2 weeks.

Thanks so much!

Re: Ask a suppor to share the logic of customize PDF transformation

Posted: Wed Jul 12, 2017 11:49 am
by ionela
Hi,

DITA Map to PDF transformation scenario is based on the DITA-OT PDF2 plugin:http://www.dita-ot.org/2.5/user-guide/dita2pdf.html
Customizing this transformation is possible, but it requires solid knowledge of XSLT and XSL-FO technologies:
https://www.w3.org/TR/xslt20/
https://www.w3.org/TR/xsl/

If you choose this method, a good starting point is this customization (we also use this to publish the Oxygen User Guide):
https://github.com/oxygenxml/com.oxygenxml.pdf2.ug

This plugin includes the following customizations for particular parts of the PDF:
  • Custom fonts
  • Cover page
  • Page headers and footers
  • First page in a chapter
  • TOC and Index
These customizations are explained in greater detail here:
https://github.com/oxygenxml/com.oxygenxml.pdf2.ug/wiki

Another alternative to customize the PDF output is to use the DITA Map PDF - WYSIWYG transformation scenario. This scenario converts DITA maps to PDF using a CSS layout processor. So, if you want to customize the generated PDF, you need to write CSS rules. This transformation scenario is described in more detail here: https://www.oxygenxml.com/doc/versions/ ... dita2.html

This second approach has some disadvantages:
- the localization support does not work out-of-the-box and requires some additional CSS rules (based on the :lang() CSS selector)
- if you use the Oxygen Chemistry CSS processor in its current form, you cannot automate the transformation process from a CLI script.

So, to summarize:
1. The first method is very powerful and allows you to achieve a great level of customization, but it requires solid knowledge of XSLT and XSL-FO.
2. The second method relies on CSS, which is far easier to understand and develop, but depending on the CSS processor you choose, it might involve additional expenses (Prince and Antenna House) or some initial delays (Oxygen Chemistry) until a more powerful version is released.

Regards,
Ionela