Meet us at PRINT 19. Chicago, IL. Oct. 3 - 5.

PsdTextFrame Class

Represents a PSD text layer.

Namespace: Aurigma.GraphicsMill.Codecs.Psd
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public class PsdTextFrame : PsdFrame, ITextSettings

Remarks

The text layer is a particular case of a raster layer. It always contains the bitmap with a rasterized text string, as well as:

  • The text string itself (the Text property).
  • The font settings (the Font property).
  • Paragraph settings (such properties as LeftIndent(), RightIndent(), Justification, and others).
  • The text color (the Color property).
  • The text box (the TextBox property).

Typically you get an instance of this class in the following way:

  1. Iterate through the layers (you will get them as PsdFrame).
  2. Check the Type property value.
  3. If it is Text, cast the frame class to PsdTextFrame.

Examples

The following code reads a PSD file, iterates through its layers, and writes some information about text layer to the console:

C#
//create PSD reader
using (var reader = new PsdReader(@"Images\BusinessCard.psd"))
{
    //read layers and check for a text layer
    for (int i = 0; i < reader.Frames.Count; i++)
    {
        using (var frame = reader.Frames[i])
        {
            if (frame.Type == FrameType.Text)
            {
                var textFrame = (PsdTextFrame) frame;
                Console.WriteLine("Font name: " + textFrame.Font.Name);
                Console.WriteLine("Font size: " + textFrame.Font.Size);
                Console.WriteLine("Text caps: " + textFrame.Caps);
                Console.WriteLine("Text justification: " + textFrame.Justification);
                Console.WriteLine("Paragraph first line indent: " + textFrame.Paragraph.FirstLineIndent);
                Console.WriteLine("Text tracking: " + textFrame.Tracking);
                Console.WriteLine("Text box: " + textFrame.TextBox);
                break;
            }
        }
    }
}

Inheritance Hierarchy

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference

Manual