FreeTextAnnotation
Overview
FreeTextAnnotation is a class in Aspose.PDF FOSS for .NET.
Inherits from: MarkupAnnotation.
This class provides 18 methods for working with FreeTextAnnotation objects in .NET programs.
Available methods include: Accept, ChangeAfterResize, ClearState, Clone, FindStateAnnotation, Flatten, FreeTextAnnotation, GetRectangle, GetState, GetStateModel, MarkupAnnotation, SetMarkedState, and 4 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Action, Actions, ActiveState, Alignment, AnnotationFlags, AnnotationState, and 54 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
DefaultAppearance | string? | Read/Write | The /DA default-appearance string. |
DefaultAppearanceObject | DefaultAppearance | Read | The strongly-typed default-appearance object backing DefaultAppearance. |
DefaultStyle | string? | Read/Write | Inline default rich-text style carried in /DS. |
RichText | string? | Read/Write | Rich text string (XHTML) for the annotation (/RC entry). |
AnnotationType | AnnotationType | Read | Always FreeText. |
Callout | Point[]? | Read/Write | Callout polyline (/CL entry, PDF 32000 §12.5.6.6 — Free text). |
Justification | Justification | Read/Write | Justification of the rendered text (/Q: 0=Left, 1=Center, 2=Right). |
Intent | FreeTextIntent | Read/Write | Free-text intent (/IT — FreeTextCallout / FreeTextTypeWriter). |
StartingStyle | LineEnding | Read/Write | Starting line-ending style (/LE first entry; callout intent only). |
EndingStyle | LineEnding | Read/Write | Ending line-ending style (/LE second entry; callout intent only). |
Rotate | Aspose.Pdf.Rotation | Read/Write | Page-rotation of the rendered text (/Rotate). |
TextRectangle | Rectangle? | Read/Write | Inner text rectangle (/RD inset from /Rect). |
TextStyle | TextStyle | Read/Write | Bundled text style (font / size / colour / alignment) applied when rendering the rich-text contents. |
CreationDate | System.DateTime | Read/Write | Creation timestamp recorded in /CreationDate. |
Opacity | double | Read/Write | Opacity (0..1) carried in /CA. |
Popup | PopupAnnotation? | Read/Write | Associated popup annotation (/Popup). |
ReplyType | ReplyType | Read/Write | Reply relationship to InReplyTo (/RT). |
Subject | string? | Read/Write | Subject line (/Subj). |
Title | string? | Read/Write | Author / title carried in /T. |
Rect | Rectangle? | Read/Write | The annotation rectangle (position on page). |
Width | double | Read/Write | The width of the annotation rectangle. |
Height | double | Read/Write | The height of the annotation rectangle. |
ActiveState | string? | Read/Write | Currently-active appearance state (/AS entry). |
Alignment | TextAlignment | Read/Write | Text alignment (for free-text / widget annotations carrying rich text). |
HorizontalAlignment | Aspose.Pdf.HorizontalAlignment | Read/Write | Horizontal alignment, exposed in addition to Alignment; the two are independently settable. |
TextHorizontalAlignment | Aspose.Pdf.HorizontalAlignment | Read/Write | Text-specific horizontal alignment override. |
Appearance | AppearanceDictionary | Read | Appearance dictionary (/AP entry) — keyed by appearance stream name (N, D, R). |
States | AppearanceDictionary | Read | Appearance-state dictionary (the per-state sub-dict of AP/N, e.g. |
NormalAppearance | XForm? | Read | The annotation’s normal (/AP /N) appearance as an XForm, or null when it has none. |
UpdateAppearanceOnConvert | bool | Read/Write | Whether to regenerate the appearance stream when the annotation is saved into a converted document. |
UseFontSubset | bool | Read/Write | Whether the embedded font (if any) should be subsetted. |
Contents | string? | Read/Write | The annotation contents (text). |
Border | Border? | Read/Write | Annotation border. |
Color | Color | Read/Write | The annotation border color (/C entry). |
InteriorColor | Color? | Read/Write | The annotation interior color (/IC entry, for circle/square/line annotations). |
Name | string? | Read/Write | The annotation name (unique identifier — the /NM entry). |
FullName | string? | Read | Fully-qualified annotation name. |
ModifiedDate | string? | Read | The modification date. |
Modified | DateTime | Read/Write | The /M (modified) date as a typed DateTime. |
Flags | AnnotationFlags | Read/Write | Annotation flags (/F entry) — used as the storage backing for both the int and typed forms. |
AnnotationFlags | AnnotationFlags | Read/Write | Typed alias of Flags exposing AnnotationFlags as a property. |
Action | PdfAction? | Read/Write | The action associated with this annotation (/A entry). |
Actions | PdfActionCollection | Read | Collection of actions associated with this annotation. |
Author | string? | Read | The annotation author (/T entry). |
AnnotationState | string? | Read | The annotation state (/State entry), e.g. |
AnnotationStateModel | string? | Read | The annotation state model (/StateModel entry), e.g. |
InReplyTo | Annotation? | Read/Write | The annotation this one is replying to (/IRT entry). |
QuadPoints | Point[] | Read/Write | QuadPoints as an array of Point values. |
Characteristics | Characteristics | Read | Appearance characteristics (border color, background color, rotation). |
PageIndex | int | Read | 1-based index of the page that owns this annotation. |
Page | Page? | Read | The page that owns this annotation, or null when it can’t be resolved (e.g. |
VerticalAlignment | VerticalAlignment | Read/Write | Vertical alignment applied to this paragraph. |
Margin | MarginInfo? | Read/Write | Outer-margin info applied to this paragraph. |
IsFirstParagraphInColumn | bool | Read/Write | Force the paragraph to start a new column. |
IsKeptWithNext | bool | Read/Write | Keep this paragraph on the same page as the next one. |
IsInNewPage | bool | Read/Write | Force the paragraph to start on a new page. |
IsInLineParagraph | bool | Read/Write | Inline paragraph flag (does not start a new line). |
HyperlinkText | string? | Read/Write | Legacy string-typed hyperlink target. |
Hyperlink | Hyperlink? | Read/Write | Typed hyperlink decoration applied to the paragraph. |
ZIndex | int | Read/Write | Z-order index used by the DOM renderer. |
Methods
| Signature | Description |
|---|---|
FreeTextAnnotation(page: Page, rect: Rectangle, appearance: DefaultAppearance) | Create a new FreeTextAnnotation with a default appearance. |
FreeTextAnnotation(document: Document, appearance: DefaultAppearance) | Document-bound ctor for creating a FreeTextAnnotation that isn’t yet attached to a specific page; the caller adds it via page.Annotations.Add(annot). |
SetTextStyle(textStyles: RichTextFontStyles, fontName: string, fontSize: double, fontColor: System.Drawing.Color) | Apply a font/size/colour bundle to the whole rich-text run. |
SetTextStyle(fromInd: int, toInd: int, textStyles: RichTextFontStyles) | Apply rich-text style flags to a substring (fromInd..toInd inclusive). |
Accept(visitor: AnnotationSelector) | Calls Accept on this FreeTextAnnotation instance. |
MarkupAnnotation(document: Document) | Document-bound ctor for creating a markup annotation that isn’t yet attached to a specific page; callers add it later via page.Annotations.Add(annot). |
GetState() | Read the /State entry on the annotation’s properties dictionary. |
GetStateModel() | Read the /StateModel entry, mapping the missing /entry to Undefined. |
SetMarkedState(marked: bool) | Set /State to Marked or Unmarked plus /StateModel = Marked. |
SetReviewState(state: AnnotationState) | Set the review state. |
ClearState() | Remove any recorded /State and /StateModel. |
FindStateAnnotation() | Find the state-tracking annotation linked to this markup (the most-recent /IRT reply annotation that carries a /State entry, per PDF 32000 §12.5.6.3). |
GetRectangle(considerRotation: bool) | Bounding rectangle adjusted by considerRotation. |
ChangeAfterResize(transform: Matrix) | Adjust the annotation’s geometry after the user resized the page or the host rectangle. |
UpdateAppearances() | Regenerate the normal appearance stream (/AP /N) from the annotation’s current geometry and colours. |
WriteXfdf(writer: System.Xml.XmlWriter) | Serialize this annotation as an XFDF element to writer (PDF 32000 §12.7.8 / XFDF 3.0). |
Flatten() | Flatten this annotation — render its visual appearance into the page content and remove it from the page’s annotations array. |
Clone() | Shallow clone — copies scalar/ref-shared state. |