pyfpdf
pyfpdf copied to clipboard
self.image() error when centering image and add_page() is called
trafficstars
With current version when adding new image at given x location, if a new page is required because of image sizing, the new x is wrong. I figured it by wrapping the 'image' method (I forced the pdf.x variable to be always the one correct):
def insert_image(self,img_path,desired_img_w=100):
self.ln()
x_img=(self.w-desired_img_w)/2
self.x=x_img
self.image(img_path,w=desired_img_w,x=x_img)
self.ln()
pyfpdf is not maintained anymore, have you tried using fpdf2?
https://pyfpdf.github.io/fpdf2/