Markus1980Wien
Markus1980Wien

Reputation: 529

iTextSharp set default font-size

I am using iTextSharp to create a new pdf-file. The pdf will contain one headline and one pdf-table. The file-size of the resultant pdf-file should be as small as possible, so I use the default font (Helvetica, 12pt). Is there a way to change the default-font-size from 12pt to 8pt.

I know that I can set the font for each pdf-table-cell.

But is it possible to set the default-font-size for the whole document/table, so that I don't need to set the font for each and every table-cell extra?

(I googled on this topic, but did not find an answer)

Upvotes: 4

Views: 23819

Answers (1)

Lara
Lara

Reputation: 3021

Try this

BaseFont bf = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL);


Paragraph p1 = new Paragraph(new Chunk("Sample text", font));

Upvotes: 7

Related Questions