xsl-fo

Page order for right-to-left languages (Arabic, Hebrew)


In most languages, books are made with the binding on the left side. The cover page is a right-side page, and a page spread consists of an even-numbered page on the left, and an odd-numbered page on the right. When you read the book in order, you flip the pages to the left.

In right-to-left (RTL) languages, this is reversed: books are made with the binding on the right side. The cover page is a left-side page, and a page spread consists of an even-numbered page on the right, and an odd-numbered page on the left. When you read the book in order, you flip the pages to the right.

I've created an FO template that will be used for multiple languages. I've used the writing-mode property to support the RTL languages.

According to this RenderX tutorial:

writing-mode property defines every aspect of the document organization: binding edge, column ordering in tables, text alignment in blocks, etc.

But I've found that's not entirely true for Antennahouse (6.1). Text alignment and column ordering all work correctly, but the binding edge is not implemented fully. The page order is still LTR.

I want to print a book in the correct page order for RTL languages:

  1. the binding must be on the right
  2. the first page of the PDF must be the last page of the book

Requirement 2. is there so I can print a multilanguage book with LTR languages at the front, and RTL languages at the back.

Now I could create a new layout-master-set for RTL languages to get the binding on the right side. After generating the PDF, I can reverse the page order of the PDF in Acrobat.

But is there a way to specify the correct page order in XSL-FO?
I'm using the Antennahouse renderer. This has the axf.reverse-page custom property, but this only works within one page-sequence. My book has several page-sequences (one per chapter), so I can't use that.

I've spent some time digging through the specification, but haven't found anything that fits.


Solution

  • Later versions of Antennahouse allow you to set the binding side of the document: Antennahouse documentation

    in XSL-FO:

    <axf:document-info name="binding" value="left"/>
    

    in CSS paged media I think this should be added to the HTML element:

    <meta name="binding" content="left" />
    

    That does not change the page order though, so -prevp (see the other answer) is also needed.