Enum JustificationMode

JustificationMode enumeration

The text alignment mode.

public enum JustificationMode

Values

NameValueDescription
Left0The left align text. In a left-to-right mode, the Left position is Left. In a right-to-left mode, the Left position is Right.
Right1The right align text. In a left-to-right mode, the Right position is Right. In a right-to-left mode, the Right position is Left.
Center2The center text.

Examples

The following code demonstrates support of JustificationMode enum to set the text alignment for text portions.

[C#]

string src = "source1107.psd";
string outputPsd = "output.psd";
string outputPng = "output.png";

using (var image = (PsdImage) Image.Load(src))
{
    var txtLayer = image.AddTextLayer("Text line1\rText line2\rText line3",
        new Rectangle(200, 200, 500, 500));
    var portions = txtLayer.TextData.Items;

    portions[0].Paragraph.Justification = JustificationMode.Left;
    portions[1].Paragraph.Justification = JustificationMode.Right;
    portions[2].Paragraph.Justification = JustificationMode.Center;

    foreach (var portion in portions)
    {
        portion.Style.FontSize = 24;
    }

    txtLayer.TextData.UpdateLayerData();

    image.Save(outputPsd);
    image.Save(outputPng, new PngOptions());
}

See Also