go-pdf / fpdf

A PDF document generator with high level support for text, drawing and images
MIT License
544 stars 48 forks source link

Add top and bottom margins for CellFormat with borders #29

Open botchedpotato opened 2 years ago

botchedpotato commented 2 years ago

It is kinda annoying when you want to add text to the top of a box and the text is right against the border.

ack3rs commented 1 year ago

I added 2 Cells around the main cell with, a small padding number, and changed the border so that the top and bottom bits blend nicely, me.CellPadding is set to 2.0.. It works ok (ish)

    me.pdf.MultiCell(WidthX, me.CellPadding, "", "RTL", "LM", true)
    me.pdf.MultiCell(WidthX, me.BodyFont.Size-5, tr(c.Text), "LR", "LM", true)
    me.pdf.MultiCell(WidthX, me.CellPadding, "", "LBR", "LM", true)