Free Support Forum - aspose.com

How to change the font size in a PDF table?

Hi,

I am using tab1e.ImportDataTable to populate my PDF. The font size is too big after importing the data into PDDF. How can I change the font size? I tried using pdf1.TextInfo.FontSize =8 but nothing changes.

Hi,

Thank you for considering Aspose.

You need to loop through each row and cell and set it's TextInfo property. Please find below code:

Aspose.Pdf.TextInfo tinfo = new Aspose.Pdf.TextInfo();

tinfo.FontSize = 8;

tinfo.FontName = "Arial";

tinfo.Color = new Aspose.Pdf.Color("Blue");

foreach (Aspose.Pdf.Row curRow in tab1.Rows)

{

foreach (Aspose.Pdf.Cell curCell in curRow.Cells)

{

curCell.DefaultCellTextInfo = tinfo;

}

}

If you need more help, please do let us know.

Thanks.