Fpdf Set Image In Center

131 Views Asked by At

How can I make it center

I am trying to center image in center but I couldn’t find a solution

def header(self):
            """
            Create header for pdf file.
            """
            self.set_left_margin(0)
            self.set_fill_color(242, 242, 242)
            self.add_font('DejaVuSerif', '', font_path, uni=True)
            self.set_font('DejaVuSerif', size=14)
            self.cell(0, 18, '', 0, 0, 'C', True)
            self.ln(1)
            self.image(name=logo_url, x=70, w=65, h=15)
            self.ln(5)

Basically the image is getting streached because I have set the width and if I remove the width and let fpdf to set it accordingly so my image would not be in center.

0

There are 0 best solutions below