Home Forums DITA and XMetaL Discussion How to add custom footer text for PDF? Reply To: How to add custom footer text for PDF?

Derek Read

Reply to: How to add custom footer text for PDF?

Appendix B in the help for XMetaL Author Enterprise 5.1 says one supported method to do what you want is to use parameters that we've configured for use (only) with the “XMetaL Enhanced PDF via RenderX XEP” deliverable type (what you select from the dropdown in the Generate Output dialog). The file it talks about is this one: [xmfo]Customizationfoxslcustom.xsl

You will need to find the ..xmfo folder installed inside the copy of the DITA OT that was installed with your copy of XMetaL Author Enterprise. The docs try to describe this, but it sounds like they are not clear enough. They are unable to assume you have installed the product to any particular predetermined location or that you are running a particular Windows version or even language so the paths they provide must be figured out by you based on your particular installation. For example, even if you install to the default path suggested by our installer the folder C:Program Files in English has different names on different language versions of Windows. Installing to Citrix will add even more complexity, etc.

To make things simple for what is possibly the most common scenario, let's hope this matches your setup (if it doesn't please let me know):
– You are running XMetaL Author Enterprise 5.1 on English Windows XP.
– You have a folder called C:Program Files where Windows normally installs your software.
– You accepted the default installation path suggested during installation.
– You are using the deliverable called “XMetaL Enhanced PDF via RenderX XEP” when you select the option “Generate Output for DITA Map…” on the File menu.

In that case the path to the file you will place parameter values in, as described in the docs, will (probably) be here:
C:Program FilesCommon FilesXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl

As an example, let's change the footer for the even pages of the “body” section of the PDF document (not the TOC, Index, or elsewhere, which have different sections). I want the three sections of my footer (left, middle and right) to have the proportions 1:10:3 because I plan to cram a bunch of text in the middle but I also suspect that my titles might be fairly long. I'm assuming my page numbers will not take up much room. That 'static' text will be “TESTING TESTING 123 HELLO WORLD”. The left part will contain the current page number and the right will contain the document title (which is extracted from the map). All of the parameters that are currently supported are documented in Appendix B (in the 5.1 help).

Open C:Program FilesCommon FilesXMetaL SharedDITA_OTdemoxmfoCustomizationfoxslcustom.xsl in a text editor and after the following comment…

…add these lines:
[code]1 10 3


Note that even this sort of assumes some understanding of XSLT. There really is no way around that at this time given the way the DITA OT works (and our integration with it).

It is very easy to make a typo when editing the XSLT, so I recommend making small changes, generating output, checking the output log file for errors and cycling through that pattern until you get what you want. Making large changes or many changes at once will obviously introduce more chances for typos. Errors in the output log file (if any) will probably mention “FO” or “XSLT”.

The first page the text “TESTING TESTING 123 HELLO WORLD” will appear on in the PDF is physical page 4, as that is the first even page in the body of the document (which by default appears after the TOC). Page 3 in this case will not have this text because we did not add settings for that section (which is …body_odd_footer…).

Appendix B (in the 5.1 release) also talks about modifying the “real” XSLT that generates output but I will not get into that here because that really requires a good handle on XSLT / XSL-FO and it is also something you will not want to try using a text editor like Notepad. You would need to do that in cases where we have not parameterized something (like inserting the date for example, or other things that might even be less complex). It is best to have a proper XSLT editor that also ideally includes a good “find in files” feature so you can hunt down all the bits and pieces that control various things. Our Professional Services team does this type of work regularly and on contractual basis for clients.