5

In PyPDF2, how to add a footer to every page of a pdf file? Do I have to do something like

page5 = reader.pages[4]
page5.mediabox.right = page5.mediabox.right / 4
page5.mediabox.top = page5.mediabox.top / 4
writer.add_page(page5)

or is there a predefined footer function?

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
Lynob
  • 5,059
  • 15
  • 64
  • 114
  • http://www.blog.pythonlibrary.org/2012/07/10/an-intro-to-pyfpdf-a-simple-python-pdf-generation-library/, tells you how to do a footer on each page – chris Jan 23 '15 at 01:16
  • @chris it's using another library - I prefer to stick with pypdf2 if possible – Lynob Jan 23 '15 at 01:17
  • @chris the thing is I googled before posting, and it was the only blog that i found about adding a footer :) – Lynob Jan 23 '15 at 10:00

1 Answers1

0

PyPDF2 does not have a footer function.

You can add a footer by

  1. Creating a single PDF page that only contains the footer, e.g. via reportlab
  2. Adding that page as an overlay (or as a watermark) - see docs
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
  • accepting the answer just to close this question after 8 years. Obviously not going to test that since after 8 years I have forgotten what the issue is about – Lynob Dec 21 '22 at 07:02