Document Page Binding

PDF documents support a metaphorical page binding, which is used when pages are laid out horizontally. Many languages use a left-to-right script, which calls for a page binding on the left edge. However, binding on the right edge is preferable for right-to-left scripts such Arabic and Hebrew and several East Asian scripts. The page binding is used with horizontal scrolling and in the thumbnails view. It has no effect when using vertical scrolling unless double-page mode is also enabled.

The page binding ought to be specified by the author when a PDF is created. However, sometimes this is not done, in which case most PDF readers will default to a left-edge binding.

Updating the Page Binding Programmatically

PSPDFKit for Android uses the PageBinding enum to define the possible values that can be used to configure a document’s page binding via the PdfDocument#setPageBinding() method.

Possible values are:

  • LEFT_EDGE — the document flows from left to right
  • RIGHT_EDGE — the document flows from right to left
  • UNKNOWN — the document does not explicitly define a page binding, so the behavior is the same as it is with LEFT_EDGE

The following snippet updates the page binding property of a document:

Copy
1
2
3
4
val document: PdfDocument = ...
// This document should be read from right to left.
document.pageBinding = PageBinding.RIGHT_EDGE
document.saveIfModified()
Copy
1
2
3
4
PdfDocument document = ...
// This document should be read from right to left.
document.setPageBinding(PageBinding.RIGHT_EDGE);
document.saveIfModified();

Affected Components

The following UI components will change their behavior based on the current document’s page binding. Keep in mind that all other UI components that aren’t mentioned here will follow the layout direction that is provided by the currently selected locale.

Document View

  • When in horizontal scrolling mode, documents with the RIGHT_EDGE page binding will scroll from right to left instead of the default left to right.
  • When in vertical double-page mode, documents with the RIGHT_EDGE page binding will have their displayed page order flipped pairwise. So the right page will be the first one, the left page will be the second one, and so on.

The Thumbnail Bar

  • In documents with the RIGHT_EDGE page binding, the order of thumbnails will be flipped, so the first page will be on the right and the last page will be on the left.
  • This also applies when in double-page mode, where the order of the pages in the pairs is also flipped.

The Thumbnail Grid

  • In documents with the RIGHT_EDGE page binding, the thumbnails will be laid out from right to left, so the first page will be on the top right.