XTextStyle LineSpacing Property. The inter-line spacing. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] double

[Visual Basic]
Double
0.0 No The inter-line spacing.

 

   

Notes
 

Allows you to adjust the distance between lines of text.

At the start of every new line of text, the text drawing position is shifted vertically by the distance specified in this property. If the value is positive this will space the lines out. If the value is negative it will shift the lines together.

You can use the font's line spacing:
doc.TextStyle.LineSpacing = doc.GetInfoDouble(doc.Font, "LineSpacing") * doc.TextStyle.Size / 1000

 

   

Example
 

In the following example we add three blocks of text to a document. The first block uses the default line spacing. The second block uses a positive value to space out the lines. The last block uses a negative value to shift the lines together.

[C#]
Doc theDoc = new Doc();
string theText = "Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani...";
theDoc.TextStyle.Size = 48;
theDoc.AddText(theText);
theDoc.Rect.Move(0, -250);
theDoc.TextStyle.LineSpacing = 20;
theDoc.AddText(theText);
theDoc.Rect.Move(0, -350);
theDoc.TextStyle.LineSpacing = -20;
theDoc.AddText(theText);
theDoc.Save(Server.MapPath("stylelspace.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
Dim theText As String = "Gallia est omnis divisa in partes tres, quarum unam incolunt Belgae, aliam Aquitani..."
theDoc.TextStyle.Size = 48
theDoc.AddText(theText)
theDoc.Rect.Move(0, -250)
theDoc.TextStyle.LineSpacing = 20
theDoc.AddText(theText)
theDoc.Rect.Move(0, -350)
theDoc.TextStyle.LineSpacing = -20
theDoc.AddText(theText)
theDoc.Save(Server.MapPath("stylelspace.pdf"))
theDoc.Clear()


stylelspace.pdf