pyfpdf icon indicating copy to clipboard operation
pyfpdf copied to clipboard

self.image() error when centering image and add_page() is called

Open MCilento93 opened this issue 3 years ago • 1 comments
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()

MCilento93 avatar Jun 22 '22 10:06 MCilento93

pyfpdf is not maintained anymore, have you tried using fpdf2? https://pyfpdf.github.io/fpdf2/

Lucas-C avatar Jul 08 '22 23:07 Lucas-C