PdfParagraph class
Namespace: 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.
public sealed class PdfParagraphInheritance
Examples
Section titled “Examples”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
Properties
Section titled “Properties”Alignment
Section titled “ Alignment”Line alignment. Default Start.
public PdfTextAlignment Alignment { get; set; }Property Value
Section titled “Property Value”Direction
Section titled “ Direction”Base direction. Default Auto.
public PdfTextDirection Direction { get; set; }Property Value
Section titled “Property Value”FirstLineIndent
Section titled “ FirstLineIndent”Indent of the first line, in points.
public double FirstLineIndent { get; set; }Property Value
Section titled “Property Value”Hyphenator
Section titled “ 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. Text keeps the words as they are, and a break is not offered inside a ligature, which would have to reshape it.
public PdfHyphenator? Hyphenator { get; set; }Property Value
Section titled “Property Value”Kashida
Section titled “ Kashida”With Justify, 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.
public bool Kashida { get; set; }Property Value
Section titled “Property Value”LineHeight
Section titled “ 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.
public double? LineHeight { get; set; }Property Value
Section titled “Property Value”The text of all spans.
public string Text { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Add(string, PdfTextStyle)
Section titled “ Add(string, PdfTextStyle)”Appends text in a style.
public PdfParagraph Add(string text, PdfTextStyle style)Parameters
Section titled “Parameters”text string
style PdfTextStyle