Hi Donald,

Sorry for the late reply.

From what I could find in the DITA-OT docs and source, it's not very easy to change to a custom pagesize, but it *is* possible. I tried it with a custom, wacky page size to see that it actually works :)

To do this you need to create a customized dita2fo-shell.xsl and have ant use this one during the build.

If you need the details, read on. There's probably a more elegant way to do this, but it works:

- create a copy of dita2fo-shell.xsl, lets call it mydita2foo-shell.xsl, for your small pages in the /lib directory. More details on custom xsls can be found here:
http://dita-ot.sourceforge.net/doc/ot-userguide131/xhtml/customizing/xslt_processing.html

- In mydita2fo-shell.xsl, locate the <fo:define-master-page> template and the underlying <fo:master-layout-set> section.

- For each <fo:simple-page-master> page style in <fo:master-layout-set>, set the new page size you want using the "page-width" and "page-height" attributes. More info and an example can be found here:
http://www.w3schools.com/xslfo/xslfo_pages.asp

Note: these attributes are actually defined in a <xsl:attribute-set> called "common-grid" at the bottom of your custom mydita2fo-shell.xsl, but anything you specify on as an attribute to <fo:simple-page-master> will override what's in the attribute set. You may probably want to change the attribute set instead. There's a nice "A4" example and a good diagram on margins in the link above.

- Change the toplevel ant build.xml script in the doc repository to *copy* the custom xsl you just created to the <dita>/xsl/ folder. Simply clone the copying of dita2fo-shell at the top of build.xml.

- Change the toplevel ant build.xml script in the doc repository to *use* the custom xsl you just created. You need to add this line to the arguments of the target "pdf.dita":
   <property name="args.xslt"
             value="${dita.lib.dir}/mydita2fo-shell.xsl"/>

- Change <dita>/ditatargets.xml to use the custom xsl for the ditamap-fo transformation, by replacing dita2fo-shell with mydita2fo-shell. Note that this messes with your dita install, so be careful! I could not get it to build with the changed pagesize if I omitted this step, basically because this is where DITA-OT decides to use either [my]dita2fo-shell.xsl.

- rebuild the docs and enjoy your custom sized pdfs.

From what I could find there are no default page sizes defined, like "Letter", "A4", or other, so you have to define each page by it's physical size. Note that you also probably want to redefine margins, text sizes and possibly other settings as well - especially if you deviate a lot from the default page size.

Hope this will get you going :)

Cheers,
Thomas

Donald McLean wrote:
Has anyone tried to recreate the documentation in a PDF format with a smaller page size?

My lovely spouse bought me a Sony PRS-505 ebook reader and 8.5x11 pages come out frighteningly cramped (but still legible) on its 3.5x4.75 inch screen. I was thinking that documents that I refer to regularly would be a useful thing to put on it.

Thank you,

Donald

--
Thomas Nielsen

Reply via email to