Skip to content

Support right-to-left ViewerPreferences #2105

@marcstober

Description

@marcstober

Explanation

I'd like to be able to create a right-to-left (RTL or in PDF, R2L) document. More specifically, I'd like to be able to set a document to open in a two page layout (which I already can do with pypdf) with the lower-numbered page on the right.

From what I can tell, this would involve adding a /ViewerPreferences dictionary to the "catalog" with a /Direction /R2L entry.

In the Acrobat UI, this is shown as setting the "Binding" to "Right Edge" (in Properties -> Advanced).

Code Example

How would your feature be used? (Remove this if it is not applicable.)

from pypdf import PdfReader, PdfWriter

pdf_out = PdfWriter()

pdf_out.page_layout = "/TwoPageRight"
pdf_out.viewer_preferences.direction = "/R2L" # new feature


...  # your new feature in action!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions