PyPDF2: how to add a footer to a pdf?

Question:

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?

Asked By: Lynob

||

Answers:

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
Answered By: Martin Thoma
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.