KingDingeling
KingDingeling

Reputation: 145

Positioning MultiCell with fpdf to the right side of the pdf document

Given

pdf.multi_cell(189, 10, text = "asdasdasdasd")

I know that this is width=180, hight = 10 and then the text. I would like to have this cell on the right side of my pdf-document, the standard is to put it on the left side. Is it possible to shift the multi_cell on the x-axis? Aligning just aligns the text inside the cell, that doesn't help. Appreciate your help on this! :)

Upvotes: 0

Views: 2238

Answers (1)

Scott
Scott

Reputation: 377

In this example from Creating Pdfs you can see how a dummy spacer cell is created to the left of the real cell you want to move rightwards, where the width of the left dummy spacer cell will be used to push the real right cell as far to the right as you specify:

    # Add an address
    self.cell(100) # Pushes next cell to right by 100 mm
    self.cell(0, 5, 'Mike Wyzowsky', ln=1)
    self.cell(100) # Pushes next cell to right by 100 mm
    self.cell(0, 5, '123 American Way', ln=1)
    self.cell(100) # Pushes next cell to right by 100 mm
    self.cell(0, 5, 'Any Town, USA', ln=1)

Upvotes: 1

Related Questions