Click or drag to resize

AppearanceSet Class

Pdf annotations support appearances that can be associated with three interaction modes NormalHow the annotation will appear under typical circumstances (ie, no interaction)RolloverHow the annotation will appear when the cursor is in the annotationActivatedHow the annotation will appear when click on Each of this modes is associated with a collection of appearances, each of which corresponds to an annotation's current state. For example, a CheckboxWidgetAnnotation defines states for when it has been checked and when it is clear. The Normal property would contain appearances for each of these states. When an annotation only has one state, the name of that state is inconsequetial and will be ignored when written to the PDF file. For naming purposes, if an annotation has only a single state with no meaningful name, you can use DefaultAppearanceName for the name.
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.AnnotationsAppearanceSet

Namespace:  Atalasoft.PdfDoc.Generating.Annotations
Assembly:  Atalasoft.PdfDoc (in Atalasoft.PdfDoc.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public class AppearanceSet : IPdfResourceConsumer

The AppearanceSet type exposes the following members.

Constructors
  NameDescription
Public methodAppearanceSet
Initializes a new instance of the AppearanceSet class. Normal, Rollover, and Activated are initialed to empty AppearanceStates
Top
Properties
  NameDescription
Public propertyActivated
Gets the Activated AppearanceStates.
Public propertyNormal
Gets the normal AppearanceStates.
Public propertyRollover
Gets the rollover AppearanceStates.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodNotifyResourceRenamed
Notifies the object that the resource was renamed.
Public methodResourcesUsed
Reports a list of all resources consumed by the object of the given class.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Public fieldStatic memberDefaultAppearanceName
A string to use for AppearanceStates objects with a single state.
Top
Examples
The following example makes an annotation with a star appearance.
PdfGeneratedDocument doc = new PdfGeneratedDocument();
PdfGeneratedPage page = doc.AddPage(PdfDefaultPages.Letter);
RectangleAnnotation anno = new RectangleAnnotation(new PdfBounds(72, 400, 200, 200));
DrawingTemplate template = new DrawingTemplate(new PdfBounds(0, 0, anno.Bounds.Width, anno.Bounds.Height));
PdfPath path = new PdfPath(PdfColorFactory.FromRgb(.8, .25, .25));
path.FillMethod = PdfFillMethod.NonZeroWinding;
path.MoveTo(100, 200);
path.LineTo(175, 0);
path.LineTo(0, 150);
path.LineTo(200, 150);
path.LineTo(25, 0);
path.Close();
template.DrawingList.Add(path);
string resourceName = doc.Resources.Templates.Add(template);
anno.Appearance = new AppearanceSet();
anno.Appearance.Normal.Add(AppearanceSet.DefaultAppearanceName, resourceName);
page.Annotations.Add(anno);
doc.Save("staranno.pdf");
See Also