reingart / pyfpdf

Simple PDF generation for Python (FPDF PHP port)
https://code.google.com/p/pyfpdf/
GNU Lesser General Public License v3.0
857 stars 524 forks source link

Adding TOC shifts pages and messes with page orientation #162

Open amauryavril opened 4 years ago

amauryavril commented 4 years ago

Hi,

I'm creating a pdf document with a table of content adapted from the attic/TOC.py script. It's all working well expect that I run into a problem when my pages have different page orientation. It seems that moving the TOC to the first page shifts all the document by the number of pages needed for the TOC. At the end I end up with wrong page orientations.

For example, let's say my last page is set up as orientation="L". If I have a TOC of one page, it will be moved at the begining of the document and will shifts my pages. At then end, I will have a landscaped penultimate page and a portrait last page.

How can I resolve this? Is there a way to move the whole page for the TOC instead of just moving the contents? Thank you for your help!

Lucas-C commented 3 years ago

PyFPDF is not maintained anymore, you may want to check PyFPDF/fpdf2 as its successor, with a 99%-compatible API