Reputation: 313
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?
Upvotes: 5
Views: 4587
Reputation: 635
Your problem is that two packages of pypdf exist, fpdf
and fpdf2
. They both use from fpdf import FPDF
, but only fpdf2 has also a format=
keyword in the add_page()
method.
So you need to install the fpdf2
package.
Upvotes: 6
Reputation: 46
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.
Upvotes: 3