How to create a 2up (2 document pages per PDF page) document using Formatter

Here's is how you can use a two-pass Formatter method to create a ‘2up' PDF with two document pages rendered on one PDF page.

1) Create the document as you normally would (with one document page per PDF page).

ahfcmd -d -o sample.pdf -x 4

2) Create a new .fo document ( that uses the same page dimensions as the original and sets the margin area sizes to 0. A separator between the pages can be created with the axf:column-rule-* and axf:column-gap Formatter extensions. Add the size of the gap to the page width. Ex:

<fo:simple-page-master master-name=”simpleExample” page-width=”420mm + 3.0pt” page-height=”297mm”>
<fo:region-body margin=”0mm” column-count=”2″ axf:column-gap=”3.0pt” axf:column-rule-style=”solid” axf:column-rule-color=”grey” axf:column-rule-width=”3.0pt”/>

3) In the new document embed all of the original pages as an external graphic. Ex:

<fo:flow flow-name=”xsl-region-body”>
<fo:external-graphic src=”sample.pdf#page=1-” />

4) Links from the embedded PDF can be preserved using the Formatter import-annotation-types option. You can set this in a Formatter configuration file. Ex:

—- config.xml —-
<pdf-settings import-annotation-types=”all” />

5) Create the new document and make sure the PDF version is the same or greater than the original document. Ex:

ahfcmd -d -o sample-2up.pdf -i config.xml -pdfver 1.7 -x 4