# PdfParagraph class

> Rich text to lay out: spans of text, each with its own style, and how lines are arranged. Line feeds (\n, \r\n) and U+2029 start a new line; tabs...

Namespace: [PdfNetStack.Drawing](https://www.jadev-corp.com/api/pdfnetstack-drawing/)  
Assembly: PdfNetStack.dll  
Package: `PdfNetStack`

Rich text to lay out: spans of text, each with its own style, and how lines are arranged. Line
feeds (\n, \r\n) and U+2029 start a new line; tabs advance four spaces; soft hyphens (U+00AD)
mark where a word may break, showing a hyphen when it does.

```csharp
public sealed class PdfParagraph
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[PdfParagraph](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfparagraph/)

## Examples

<pre><code class="lang-csharp">var body = new PdfTextStyle(inter, 11);
var p = new PdfParagraph { Alignment = PdfTextAlignment.Justify, LineHeight = 1.5 }
    .Add("Invoices are due within ", body)
    .Add("30 days", body with { Font = interBold });
PdfTextLayout layout = g.DrawText(p, 50, 100, 300);   // returns the lines and the height used</code></pre>

## Properties

### <a id="PdfNetStack_Drawing_PdfParagraph_Alignment"></a> Alignment

Line alignment. Default [Start](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextalignment/).

```csharp
public PdfTextAlignment Alignment { get; set; }
```

#### Property Value

 [PdfTextAlignment](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextalignment/)

### <a id="PdfNetStack_Drawing_PdfParagraph_Direction"></a> Direction

Base direction. Default [Auto](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextdirection/).

```csharp
public PdfTextDirection Direction { get; set; }
```

#### Property Value

 [PdfTextDirection](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextdirection/)

### <a id="PdfNetStack_Drawing_PdfParagraph_FirstLineIndent"></a> FirstLineIndent

Indent of the first line, in points.

```csharp
public double FirstLineIndent { get; set; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

### <a id="PdfNetStack_Drawing_PdfParagraph_Hyphenator"></a> Hyphenator

Breaks words at the line's end with a hyphen where this hyphenator allows it, as lines fill.
Null, the default, breaks only between words and at soft hyphens. It applies to the whole
paragraph, whatever the spans; for text in several languages, insert soft hyphens span by
span with [InsertSoftHyphens](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfhyphenator/#PdfNetStack_Drawing_PdfHyphenator_InsertSoftHyphens_System_String_). [Text](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfparagraph/#PdfNetStack_Drawing_PdfParagraph_Text) keeps the words
as they are, and a break is not offered inside a ligature, which would have to reshape it.

```csharp
public PdfHyphenator? Hyphenator { get; set; }
```

#### Property Value

 [PdfHyphenator](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfhyphenator/)?

### <a id="PdfNetStack_Drawing_PdfParagraph_Kashida"></a> Kashida

With [Justify](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextalignment/), right to left Arabic script lines are justified
by elongating joined letters with tatweel (kashida) before spaces widen: one elongation per
word, up to three tatweel widths, at the point Arabic typography prefers (after seen and
sad, before a final heh, dal, alef, lam, kaf, reh or waw, else the last join of the word).
Fonts without a tatweel glyph justify with spaces only. Off by default.

```csharp
public bool Kashida { get; set; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="PdfNetStack_Drawing_PdfParagraph_LineHeight"></a> LineHeight

Line height as a multiple of each span's font size, as CSS line-height takes a number; null
for the font's own spacing (ascent, descent and line gap), like CSS normal.

```csharp
public double? LineHeight { get; set; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)?

### <a id="PdfNetStack_Drawing_PdfParagraph_Text"></a> Text

The text of all spans.

```csharp
public string Text { get; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="PdfNetStack_Drawing_PdfParagraph_Add_System_String_PdfNetStack_Drawing_PdfTextStyle_"></a> Add\(string, PdfTextStyle\)

Appends text in a style.

```csharp
public PdfParagraph Add(string text, PdfTextStyle style)
```

#### Parameters

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

`style` [PdfTextStyle](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdftextstyle/)

#### Returns

 [PdfParagraph](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfparagraph/)

## Used in

- [Fonts and text in PDF with C# and .NET](https://www.jadev-corp.com/guides/fonts-and-text/)
- [CSS support in PdfNetStack.Html](https://www.jadev-corp.com/guides/html-to-pdf/css-support/)
- [Write Arabic text in a PDF in C#](https://www.jadev-corp.com/recipes/arabic-text-pdf/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-drawing/pdfparagraph/
