Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the font-size in PdfPTable?

Tags:

c#

asp.net

itext

I am using itextsharp to dynamically write on the pdf. I am creating a table in the pdf document which contains the values from the database. Can someone please tell how to modify the font-size of the values in the table.

like image 877
Aada Avatar asked Jul 23 '12 19:07

Aada


2 Answers

Try this:

Font fontH1 = new Font(Currier, 16, Font.NORMAL);

PdfPTable table = new PdfPTable(1);

table.AddCell(new PdfPCell(new Phrase(yourDatabaseValue,fontH1)));
like image 150
Pablo Claus Avatar answered Sep 21 '22 11:09

Pablo Claus


Please try by setting font to the PdfPTable.DefaultCell property

Example:

pdfTable.DefaultCell.Phrase = new Phrase() { Font = fontNormal };

I have already answer this before : Set font for all text from Pdfptable with Itextsharp

like image 27
HatSoft Avatar answered Sep 18 '22 11:09

HatSoft