[Python] Cant place an image at the bottom of a pdf file using fpdf python

Discussão em 'Python' iniciado por Stack, Junho 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Python and I'm trying to place three images that cover the entire page. The last image creats and jumps to the next page, I think beacuse of the 'footer'. How can I disable this footer or overcome it?

    from PIL import Image
    from fpdf import FPDF


    class PDF(FPDF):
    pass


    def imagex(self):
    self.set_xy(0, 0)
    self.image(fr'C:\Users\user\Desktop\pictures\1.jpeg', link='', type='', w=210, h=100)
    self.set_xy(0, 100)
    self.image(fr'C:\Users\user\Desktop\pictures\2.jpeg', link='', type='', w=210, h=100)
    #This is where the picture jumps
    self.set_xy(0, 200)
    self.image(fr'C:\Users\user\Desktop\pictures\3.jpeg', link='', type='', w=210, h=100)


    if __name__ == '__main__':
    pdf = PDF()
    pdf.add_page()
    imagex(pdf)
    pdf.output(r'C:\Users\user\Desktop\test.pdf', 'F')

    Continue reading...

Compartilhe esta Página