[reportlab-users] Encrypting PDF changes page orientation

Chris Buergi cb at enerweb.ch
Thu Apr 24 05:00:53 EDT 2014


I'm using the encryptPdfInMemory() to protect a PDF from being edited.

My input PDF contains one page with landscape orientation (about half
way in the doc), the rest of the pages are in portrait. Now when I
encrypt the PDF the landscape page gets converted to portrait, but the
content stays as it was in the input data, thus cutting off some of the

I also tried to encrypt the PDF through the command line, which gives
the same result.

The code I use to encrypt is the following:
encryptPdfInMemory(pdf_bytes, '', 'password', canModify=0, canCopy=0,

The PDF is generated from a RML file, where I change the page
orientation like this:
... some pages in portrait ...
<setNextTemplate name="report_a4_landscape"/>
<nextPage />
... some tables and text ...
<setNextTemplate name="report_a4_portrait"/>

I'm happy to send the input PDF if needed for reproducing the issue.

Further, I'm using Reportlab Version 2.7 with Python 2.7.


Enerhaus Web Services GmbH
Postweg 7
4528 Zuchwil

Tel 032 685 25 05
Fax 032 685 56 06

More information about the reportlab-users mailing list