Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set PDF paragraph or font line-height with iTextSharp?

How can I change the line-height of a PDF font or paragraph using iTextSharp?

like image 540
Petrus Theron Avatar asked Apr 13 '10 14:04

Petrus Theron


People also ask

How to give space in iText pdf?

Just insert "\n", should do the trick.

How to add space in paragraph in iText?

To set the line spacing of a paragraph in iText can be done by passing the line space / leading argument in the Paragraph constructor. In the example below we set the line space to 32 . We can also set the space between paragraph by calling the setSpacingBefore() and setSpacingAfter() methods of this object.

When you are using 14px type for the text a good line height is?

A good rule of thumb is to set your line height at approximately 145-150% of your text size. For example, 14px text often works well at a 21px (150%) line height, 15px text often works well at a 22px (146%) line height, and so on.

What is iText leading?

According to the PDF specification, the distance between the baseline of two lines is called the leading. In iText, the default leading is 1.5 times the size of the font. For instance: the default font size is 12 pt, hence the default leading is 18.


1 Answers

Line spacing in terms of typography is called leading. If you can use line spacing, you can use Paragraph.Leading or Paragraph.LeadingMultiplier. See http://itextsharp.sourceforge.net/tutorial/ch02.html#phrase

like image 191
Mitch Avatar answered Oct 11 '22 18:10

Mitch