Skip to content

Page format and orientation

By default, a FPDF document has a A4 format with portrait orientation.

Other formats & orientation can be specified to FPDF constructor:

pdf = fpdf.FPDF(orientation="landscape", format="A5")

Currently supported formats are a3, a4, a5, letter, legal or a tuple (width, height). Additional standard formats are welcome and can be suggested through pull requests.

Per-page format and orientation

The following code snippet illustrate how to configure different page formats for specific pages:

from fpdf import FPDF

pdf = FPDF()
for i in range(9):
    pdf.add_page(format=(210 * (1 - i/10), 297 * (1 - i/10)))

Similarly, an orientation parameter can be provided to the add_page method.