'Python FPDF multi_cell table with more lines of text in one cell issue

I try to make some pdf file with tables, and some cells contain more than one line of text, I already came up to a solution for adjusting height of the table, however the visual representation looks gross, do you have any ideas how to center the text horizontally? Part of the output is shown on the image below the code.

        col_height_ratio = math.ceil(pdf.get_string_width(str(response3.json()['title']).encode('latin-1', 'replace').decode('latin-1'))/(col_width/1.5))

        pdf.multi_cell(col_width/6, line_height*col_height_ratio, str(response3.json()['key']).encode('latin-1', 'replace').decode('latin-1'), border=1, ln=3, max_line_height=pdf.font_size, align='C')
        pdf.multi_cell(col_width/1.5, line_height*col_height_ratio, str(response3.json()['title']).encode('latin-1', 'replace').decode('latin-1'), border=1, ln=3, max_line_height=pdf.font_size, align='C')
        pdf.multi_cell(0, line_height*col_height_ratio, str(status).encode('latin-1', 'replace').decode('latin-1'), border=1, ln=3, max_line_height=pdf.font_size, align='C')
        pdf.ln(line_height*col_height_ratio)

The comparison



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source