Fix Table Text Alignment on Advanced PDF Template

This article will help you if you are encountering an unusual HTML table <td> cell alignment effect in the generated PDF.

Unusual Alignment

Solution

The solution is to simply wrap the cell contents inside of a <p> tag. Then add the proper style declaration “style=” with the desired text alignment parameter “text-align: center;” or whatever other text alignment you want.

<td align="center" colspan="2">${record.memo}</td> 

Change this to ---->
<td align="center" colspan="2"><p style="text-align: center;">${record.memo}</p></td>

Proper Alignment

Leave a comment

Your email address will not be published. Required fields are marked *