Search code examples
python-3.xpdffpdf

PyFPDF can't add page while specifying the size


on pyfpdf documentation it is said that it is possible to specify a format while adding a page (fpdf.add_page(orientation = '', format = '', same = False)) but it gives me an error when specifying a format.

error:

pdf.add_page(format = (1000,100)) TypeError: add_page() got an unexpected keyword argument 'format'

i've installed pyfpdf via pip install and setup.py install but it doesnt work in both ways

how can i solve this?


Solution

  • When you checked the documentation from python using help() you can find out that add_page() only accept one argument.

    add_page(self, orientation='') Start a new page

    It seems inconsistent with the documentation they wrote on pypdf. But this happen if you install fpdf via pip. Try install it from github master branch. This should fix it.