ImageGear .NET v25.1 - Updated
IPCC.Mark
API Reference > ViewerControl API > IPCC.Mark

Class: Mark

IPCC.Mark(parameters)

The IPCC.Mark object represents an annotation. (We use the term "mark" as a generic term for annotations.) #####Marks Drawn on the Document Typically a Mark object represents a mark that is drawn on the document. In the case that a Mark object represents, a mark drawn on the document, then setting properties of the Mark object will cause the appearance of the mark on the document to be updated. To add a new mark to a document, use the method IPCC.ViewerControl#addMark. #####Mark Properties All marks have the following **read-only properties** that are set when the API creates the Mark object. - `.getId()` and `.id` - `.getType()` and `.type` - `.getPageNumber()` and `.pageNumber` A Mark object can also have a number of **writable properties**, which are define on the object depending on the mark type. For example, a Mark object with type `LineAnnotation` will have a property `.startPoint`, accessible through `.getStartPoint()` and `.setStartPoint(...)`, but a Mark object with the type `RectangleAnnotation` will not have the property `.startPoint`. Or, a Mark object with the type `StampAnnotation` will have a property `.color`, accessible through `.getColor()` and `.setColor(...)` and a `LineAnnotation` Mark object also has the property `.color`. The full list of Mark properties is listed below. The documentation lists what properties are on what mark types, and vice versa. To programatically determine if a mark has a property, use the JavaScript `in` operator. Or use the `!` operator if you are referencing the property's getter or setter method. Examples are shown below. !!myMarkObject.getStartPoint; // true if the startPoint property was added to the Mark object //Note: this option will only be available in ECMAScript 5 comaptible browsers 'startPoint' in myMarkObject; // true if the startPoint property was added to the Mark object #####Template Marks A Mark object can also act as a template for mouse tools that create marks. For example, a `LineAnnotation` mouse tool will have a "template mark" that is used as a template for any mark created by the mouse tool. Setting the color of the template mark to yellow will cause all marks created by the mouse tool to be yellow. The template mark is accessible via the method IPCC.MouseTool#getTemplateMark.

Constructor

new Mark(parameters)

_NOTE: this constructor is for internal use only._ To programmatically add a Mark (an annotation) to a document, use IPCC.ViewerControl#addMark.
Parameters:
Name Type Description
parameters Object The parameters object takes the following properties: - `type` {string} [required] Mark Type IPCC.Mark.Type - `pageNumber` {number} [optional] Page Number on which the Mark is located . If this property is not specified, the page number will default to the current page.
See:
Example
var viewerControl = new IPCC.ViewerControl(...);

// use IPCC.ViewerControl#addMark(pageNumer, markType) to create
// and add a mark instead of new Mark()
viewerControl.addMark(1, "LineAnnotation");

Members

(static, readonly) FontStyles :string

The `IPCC.Mark.FontStyles` enumeration defines Font Styles known to the ViewerControl. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you may pass string values of the `FontStyles` (enumeration values).
Type:
  • string
Properties:
Name Type Description
Bold string Specifies that the text should be bold.
Italic string Specifies that the text should be italic.
Strikeout string Specifies that the text should be struck out.
Underline string Specifies that the text should be underlined.
See:
Example
// use the enumeration to make text Bold
mark.setFontStyle([IPCC.Mark.FontStyles.Bold]);

// or just use the string value. Note: The parameter should be an array of styles required.
mark.setFontStyle(["Bold"]);

(static, readonly) HorizontalAlignment :string

The `IPCC.Mark.HorizontalAlignment` enumeration defines horizontal alignment known to the ViewerControl. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you may pass string values of the `HorizontalAlignment` (enumeration values).
Type:
  • string
Properties:
Name Type Description
Center string Specifies that the text should be centered horizontally.
Left string Specifies that the text should be left-justified.
Right string Specifies that the text should be right-justified.
Example
// use the enumeration to make text centered
mark.setHorizontalAlignment(IPCC.Mark.HorizontalAlignment.Center);

// or just use the string value
mark.setHorizontalAlignment("Center");

(static, readonly) InteractionMode :string

The `IPCC.Mark.InteractionMode` enumeration defines possible interaction modes for a Mark. The interaction mode affects the behavior of the mark when the user interacts with the mark through mouse, touch, or API. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you may pass string values of the `InteractionMode` (enumeration values).
Type:
  • string
Properties:
Name Type Description
Full string Specifies that the mark is fully interactive using the mouse, touch-input, and API.
SelectionDisabled string Specifies that the mark cannot be selected. **Note:** If a mark is selected when the mark’s interaction mode is set to "SelectionDisabled", then the mark will be deselected and the ViewerControl’s MarkSelectionChanged event will fire.
See:
Example
// use the enumeration to make the mark non-selectable
mark.setInteractionMode(IPCC.Mark.InteractionMode.SelectionDisabled);

// or just use the string value of the enumeration
mark.setInteractionMode("SelectionDisabled");

(static, readonly) LineHeadType :string

The `IPCC.Mark.LineHeadType` enumeration defines Mark `LineHeadTypes` known to the ViewerControl. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you may pass string values of the `LineHeadType` (enumeration values).
Type:
  • string
Properties:
Name Type Description
None string No line head.
FilledTriangle string A filled triangle line head. **Note:** this makes the line an arrow. :)
Example
// use the enumeration to make a line an arrow
myLineAnnotation.setEndHeadType(IPCC.Mark.LineHeadType.FilledTriangle);

// or just use the string value
myLineAnnotation.setEndHeadType("FilledTriangle");

(static, readonly) Type :string

The `IPCC.Mark.Type` enumeration defines Mark Types known to the ViewerControl. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you may pass string values of the `Type` (enumeration values).
Type:
  • string
Properties:
Name Type Description
LineAnnotation string This mark is drawn as a line on the document. A head can be added to the end of the line to make the line an arrow. The properties specific for this are: `color`, `thickness`, `opacity`, `startPoint`, `endPoint`, `endHeadType`.
RectangleAnnotation string This mark is drawn as a rectangle on the document. The properties specific for this are: `fillColor`, `opacity`, `borderColor`, `borderThickness`, `rectangle`.
EllipseAnnotation string This mark is drawn as an ellipse on the document. The properties specific for this are: `fillColor`, `opacity`, `borderColor`, `borderThickness`, `rectangle`.
TextAnnotation string This mark is drawn as text on the document. The text has a background and border. The properties specific for this are: `text`, `fontColor`, `fillColor`, `opacity`, `borderColor`, `borderThickness`, `fontName`, `fontSize`, `fontStyle`, `horizontalAlignment`, `rectangle`.
PolylineAnnotation string This mark is drawn as a Polyline on the document. It is in a form of a set of connected line segments. The properties specific for this are: `color`, `thickness`, `opacity`, `points`.
PolygonAnnotation string This mark is drawn as a Polygon on the document. It is in a form of a set of connected line segments with a fill color. The properties specific to this are: `color`, `fillColor`, `thickness`, `opacity`, `points`.
Example
// use the enumeration to make a line annotation
myViewerControl.addMark(1, IPCC.Mark.Type.LineAnnotation);

// or just use the string value
myViewerControl.addMark(1, "LineAnnotation");

borderColor :string

Gets or sets the border color of the Mark. This property is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('borderColor' in mark) {
    var oldValue = mark.borderColor;
    mark.borderColor = "#FF0000"; // set border color to red
}

borderThickness :number

Gets or sets the border thickness of the Mark. This property is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
if ('borderThickness' in mark) {
    var oldValue = mark.borderThickness;
    mark.borderThickness = 3; // set the border thickness of the mark
}

boundingRectangle :Object

Gets the bounding rectangle of the Mark. This property is defined on all Mark objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
var boundingRectangle = mark.boundingRectangle;

color :string

Gets or sets the color of the Mark. This property is defined on marks of type: `LineAnnotation` and PolylineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('color' in mark) {
    var oldValue = mark.color;
    mark.color = "#FF0000"; // set color to red
}

(readonly) conversation :string

Gets the conversation associated with the Mark. This property is defined on all Mark objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
var conversation = mark.conversation;

endHeadType :string

Gets or sets the end head type of the Mark. The value of end head type determines if the line looks like an arrow or a plain line. This property is defined on marks of type: `LineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('endHeadType' in mark) {
    var oldValue = mark.endHeadType;

    // set the head to be a filled triangle, so the line looks like an arrow
    mark.endHeadType = "FilledTriangle";
}

endPoint :Object

Gets or sets the end point coordinates of the line Mark. This property is defined on marks of type: `LineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
if ('endPoint' in mark) {
    var oldValue = mark.endPoint;
    mark.endPoint = {x: 100, y: 100}; // set the start point to (100, 100)
}

endPoint :Object

Gets or sets the end point coordinates of the line Mark. This property is defined on marks of type: `LineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
if ('endPoint' in mark) {
    var oldValue = mark.endPoint;
    mark.endPoint = {x: 100, y: 100}; // set the start point to (100, 100)
}

fillColor :string

Gets or sets the fill color of the Mark. This property is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('fillColor' in mark) {
    var oldValue = mark.fillColor;
    mark.fillColor = "#FF0000"; // set color to red
}

fillVisible :boolean

Gets or sets the fill visible property of the Mark. This property is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `PolygonAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • boolean
See:
Example
if ('fillVisible' in mark) {
    var oldValue = mark.fillVisible;
    mark.fillVisible = false; // set filling visibility to false
}

fontColor :string

Gets or sets the font color of the text in the Mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('fontColor' in mark) {
    var oldValue = mark.fontColor;
    mark.fontColor = "#ffccbb";
}

fontName :string

Gets or sets the font name of the text in the Text Mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('fontName' in mark) {
    var oldValue = mark.fontName;
    mark.fontName = "Aerial";
}

fontSize :number

Gets or sets the font size (in points) for the text in the Text Mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
if ('fontSize' in mark) {
    var oldValue = mark.fontSize;
    mark.fontSize = 12;
}

fontStyle :Array.<string>

Gets or sets the font Style of the text in the mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Array.<string>
See:
Example
if ('fontStyle' in mark) {
    var oldValue = mark.fontStyle;
    mark.fontStyle = ["Bold",Underline,Italic];
}

horizontalAlignment :string

Gets or sets the text horizontal alignment of the text in the Text Mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('horizontalAlignment' in mark) {
    var oldValue = mark.horizontalAlignment;
    mark.horizontalAlignment = "left";
}

(readonly) id :string

Gets the ID of the Mark. This property is defined on all Mark objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
var id = mark.id;

interactionMode :string

Gets or sets a value that indicates the allowed interactions with the mark. Possible values are defined in the enumeration IPCC.Mark.InteractionMode. This property is defined on all Mark objects. _This is an ECMA 5 property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
// get
var interactionMode = mark.interactionMode;

// set
mark.interactionMode = IPCC.Mark.InteractionMode.SelectionDisabled;

maxLength :number

Gets or sets a value that determines the max length of text for a mark This method is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
// get
var maxLength = mark.maxLength;

// set
mark.maxLength = 13;

opacity :number

Gets or sets the opacity of the Mark. This value is a number between 0 and 255. This property is defined on marks of type: `LineAnnotation`, `RectangleAnnotation`, `EllipseAnnotation`, `TextAnnotation`, and `PolylineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
if ('opacity' in mark) {
    var oldValue = mark.opacity;
    mark.opacity = 127; // set the opacity so that the mark is transparent
}

(readonly) pageNumber :number

Gets the page number of the page that the Mark is on. This property is defined on all Mark objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
var pageNumber = mark.pageNumber;

rectangle :Object

Gets or sets the bounding rectangle of the Mark. This property is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
if ('rectangle' in mark) {
    var oldValue = mark.rectangle;
    mark.rectangle = {x: 0, y: 0, width: 100, height: 100};
}

startPoint :Object

Gets or sets the start point coordinates of the line Mark. This property is defined on marks of type: `LineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
if ('startPoint' in mark) {
    var oldValue = mark.startPoint;
    mark.startPoint = {x: 1, y: 1}; // set the start point to (1, 1)
}

text :string

Gets or sets the text in the Mark. This property is defined on marks of type: `TextAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('text' in mark) {
    var oldValue = mark.text;
    mark.text = "This is a Test";
}

thickness :number

Gets or sets the thickness of the Mark. This property is defined on marks of type: `LineAnnotation` and `PolylineAnnotation`. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
if ('thickness' in mark) {
    var oldValue = mark.thickness;
    mark.thickness = 3; // set the thickness of the mark
}

(readonly) type :string

Gets the type of the Mark. This property is defined on all Mark objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
switch (mark.type) {
    case IPCC.Mark.Type.LineAnnotation:
        ...
        break;
    default:
        ...
}

visible :string

Gets or sets the Mark visible. This property is defined on all mark types. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • string
See:
Example
if ('visible' in mark) {
    var oldValue = mark.visible;
    mark.visible = true; // set mark to visible
}

Methods

getBorderColor() → {string}

Gets the border color of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation`, `PolygonAnnotation` and `TextAnnotation`.
See:
Returns:
The border color of the Mark as a hexadecimal string.
Type
string
Example
if (mark.getBorderColor) {
    var borderColor = mark.getBorderColor();
}

getBorderThickness() → {number}

Gets the border thickness of the mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
See:
Returns:
The border thickness of the mark.
Type
number
Example
if (mark.getBorderThickness) {
    var borderThickness = mark.getBorderThickness();
}

getBoundingRectangle() → {Object}

Gets the bounding rectangle for the Mark. This method is defined on all Mark objects.
See:
Returns:
A rectangle object of the type `{x: xValue, y: yValue, width: widthValue, height: heightValue}`.
Type
Object
Example
var boundingRectangle = mark.getBoundingRectangle();

getColor() → {string}

Gets the color of the Mark. This method is defined on marks of type: `LineAnnotation` and `PolylineAnnotation`.
See:
Returns:
The color of the Mark as a hexadecimal string.
Type
string
Example
if (mark.getColor) {
    var color = mark.getColor();
}

getConversation()

Gets the conversation associated with the Mark. This method is defined on all Mark objects.
Returns:
`IPCC.Conversation` The conversation associated with this Mark.

getData(key) → {string|object}

Gets the data value for the given key, or gets a hash containing all key values, if a key was not provided. This method is defined on all Mark objects.
Parameters:
Name Type Description
key string The key for which to get the data value.
See:
Throws:
If the `key` argument is null or otherwise not a string.
Type
Error
Returns:
- If a key argument was provided, it returns the associated value. - If a key argument was provided, but a value has not been associated with the key, then it returns undefined. - If a key was not provided, it returns a hash object containing all key-value pairs.
Type
string | object
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// The key "Author" is set the value "Mark".
mark.setData("Author", "Mark");

// The key "Note" is set the value "This is really important!".
mark.setData("Note", "This is really important!");

mark.getData("Author"); // returns "Mark"
mark.getData();         // returns {"Author":"Mark", "Note":"This is really important!"}
mark.getData("FooBar"); // returns undefined

getDataKeys() → {Array.<string>}

Gets an array of data keys known to this Mark. This method is defined on all Mark objects.
See:
Returns:
Returns an array of data keys known to this Mark. If no data is stored, then an empty array will be returned.
Type
Array.<string>
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// Returns an empty array before KVPs are stored.
mark.getDataKeys(); // returns []

// Returns a list of all keys.
mark.setData("Author", "Mark");
mark.setData("Note", "This is really important!");
mark.getDataKeys(); // returns ["Author", "Note"]

getEndHeadType() → {string|IPCC.Mark.LineHeadType}

Gets the line Mark end head type. This method is defined on marks of type: `LineAnnotation`.
See:
Returns:
A line head type enum value.
Type
string | IPCC.Mark.LineHeadType
Example
if (mark.getEndHeadType) {
    var endHeadType = mark.getEndHeadType();
}

getEndPoint() → {Object}

Gets the end point coordinates of the line Mark. This method is defined on marks of type: `LineAnnotation`.
See:
Returns:
A point object of the type `{x: xvalue, y: yvalue}`
Type
Object
Example
if (mark.getEndPoint) {
    var endPoint = mark.getEndPoint();
}

getFillColor() → {string}

Gets the fill color of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
See:
Returns:
The fill color of the Mark as a hexadecimal string.
Type
string
Example
if (mark.getFillColor) {
    var fillColor = mark.getFillColor();
}

getFillVisible() → {boolean}

Gets the fill visible property value of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `PolygonAnnotation`.
See:
Returns:
The fill visible property of the Mark as a boolean.
Type
boolean
Example
if (mark.getFillVisible) {
    var fillVisible = mark.getFillVisible();
}

getFontColor() → {string}

Gets the font color of the text contained in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
The text contained in the Text mark.
Type
string
Example
if (mark.getFontColor) {
    var text = mark.getFontColor();
}

getFontName() → {string}

Gets the font color of the text contained in the Mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
The text contained in the Text mark.
Type
string
Example
if (mark.getFontName) {
    var text = mark.getFontName();
}

getFontSize() → {number}

Gets the font size (in points) of the text in the Mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
The font size of the text in the text mark.
Type
number
Example
if (mark.getFontSize) {
    var fontSize = mark.getFontSize();
}

getFontStyle() → {Array.<string>}

Gets an array of font styles of the text contained in the mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
An array containing the font styles of text contained in the Text mark.
Type
Array.<string>
Example
if (mark.getFontStyle) {
    var fontStyleArray = mark.getFontStyle();
}

getHorizontalAlignment() → {string}

Gets the horizontalAlignment of the text contained in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
A string containing horizontalAlignment contained in the Text mark.
Type
string
Example
if (mark.getHorizontalAlignment) {
    var horizontalAlignment = mark.getHorizontalAlignment();
}

getId() → {string}

Gets the ID of the Mark. This method is defined on all Mark objects.
See:
Returns:
The ID of the Mark.
Type
string
Example
var markId = mark.getId();

getInteractionMode() → {string}

Gets a value that indicates the allowed interactions with this mark. This method is defined on all Mark objects.
See:
Returns:
A string value from the enumeration IPCC.Mark.InteractionMode, which indicates the allowed interactions with this mark.
Type
string
Example
var interactionMode = mark.getInteractionMode();

getLineStyle() → {int}

Gets the border line style of the Mark. This method is defined on marks of type: `PolylineAnnotation`, and `PolygonAnnotation`.
See:
  • IPCC.Web.UI.LineStyle
Returns:
The enumeration value of the line style.
Type
int
Example
if (mark.getLineStyle) {
    var borderStyle = mark.getLineStyle();
}

getMaxLength() → {Number}

Gets the applied max length for the mark. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
The max length for the mark.
Type
Number
Example
if (mark.getMaxLength) {
    var mask = mark.getMaxLength();
}

getOpacity() → {number}

Gets the opacity of the Mark. This value is a number between 0 and 255. This method is defined on marks of type: `LineAnnotation`, `RectangleAnnotation`, `EllipseAnnotation`, `TextAnnotation`, `PolygonAnnotation`.
See:
Returns:
The opacity of the line.
Type
number
Example
if (mark.getOpacity) {
    var opacity = mark.getOpacity();
}

getPageNumber() → {number}

Gets the page number where the Mark object is located. This method is defined on all Mark objects.
See:
Returns:
The page number where the Mark is located.
Type
number
Example
var pageNumber = mark.getPageNumber();

getPoints() → {Array}

Gets the array of points that make up coordinates of the vertices of the PolylineAnnotation Mark. This method is defined on marks of type: `PolylineAnnotation`.
See:
Returns:
of point objects of the type `{x: xvalue, y: yvalue}`
Type
Array
Example
if (mark.getPoints) {
    var points = mark.getPoints();
}

getRectangle() → {Object}

Gets the bounding rectangle for the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
See:
Returns:
A rectangle object of the type `{x: xValue, y: yValue, width: widthValue, height: heightValue}`.
Type
Object
Example
if (mark.getRectangle) {
    var boundingRectangle = mark.getRectangle();
}

getSessionData(key) → {string|object}

Gets the session data value for the given key, or gets a hash containing all key values, if a key was not provided. Unlike IPCC.Mark#getData, this data is not saved with the annotation, it only lasts for the session. This method is defined on all Mark objects.
Parameters:
Name Type Description
key string The key for which to get the data value.
See:
Throws:
If the `key` argument is null or otherwise not a string.
Type
Error
Returns:
- If a key argument was provided, it returns the associated value. - If a key argument was provided, but a value has not been associated with the key, then it returns undefined. - If a key was not provided, it returns a hash object containing all key-value pairs.
Type
string | object
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// The key "Visibility" is set the value "Shown".
mark.setSessionData("Visibility", "Shown");

// The key "Note" is set the value "This is not going to be saved!".
mark.setSessionData("Note", "This is not going to be saved!");

mark.getSessionData("Visibility"); // returns "Shown"
mark.getSessionData();             // returns {"Visibility":"Shown", "Note":"This is not going to be saved!"}
mark.getSessionData("FooBar");     // returns undefined

getSessionDataKeys() → {Array.<string>}

Gets an array of data keys known to this Mark. Unlike IPCC.Mark#getDataKeys, this data is not saved with the annotation, it only lasts for the session. This method is defined on all Mark objects.
See:
Returns:
Returns an array of data keys known to this Mark. If no data is stored, then an empty array will be returned.
Type
Array.<string>
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// Returns an empty array before KVPs are stored.
mark.getSessionDataKeys(); // returns []

// Returns a list of all keys.
mark.setSessionData("Visibility", "Shown");
mark.setSessionData("Note", "This is not going to be saved!");
mark.getSessionDataKeys(); // returns ["Visibility", "Note"]

getStartPoint() → {Object}

Gets the start point coordinates of the line Mark. This method is defined on marks of type: `LineAnnotation`.
See:
Returns:
A point object of the type `{x: xvalue, y: yvalue}`
Type
Object
Example
if (mark.getStartPoint) {
    var startPoint = mark.getStartPoint();
}

getText() → {string}

Gets the text contained in marks with text or text-selection based marks. This method is defined on marks of type: `TextAnnotation`.
See:
Returns:
The text contained in the in the above mentioned mark types.
Type
string
Example
if (mark.getText) {
    var text = mark.getText();
}

getThickness() → {number}

Gets the thickness of the line. This method is defined on marks of type: `LineAnnotation` and `PolylineAnnotation`.
See:
Returns:
The thickness of the line.
Type
number
Example
if (mark.getThickness) {
    var thickness = mark.getThickness();
}

getType() → {string}

Gets the type of the Mark type. This method is defined on all Mark objects.
See:
Returns:
The type of Mark.
Type
string
Example
switch (mark.getType()) {
    case IPCC.Mark.Type.LineAnnotation:
        ...
        break;
    default:
        ...
}

getVisible() → {boolean}

Gets the visibility of the Mark. This method is defined on all mark types.
See:
Returns:
Returns true if the mark is visible, false otherwise.
Type
boolean
Example
if (mark.getVisible) {
    var visible = mark.getVisible();
}

setBorderColor(value) → {IPCC.Mark}

Sets the border color of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation`, `PolygonAnnotation` and `TextAnnotation`.
Parameters:
Name Type Description
value string Hexadecimal string representing border color. This string must be prepended with '#' character.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setBorderColor) {
    mark.setBorderColor("#FF0000"); // set the border color to red
}

setBorderThickness(value) → {IPCC.Mark}

Sets the border thickness of the mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
Parameters:
Name Type Description
value number Border thickness of the mark.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setBorderThickness) {
    mark.setBorderThickness(3);
}

setColor(value) → {IPCC.Mark}

Sets the color of the Mark. This method is defined on marks of type: `LineAnnotation` and `PolylineAnnotation`.
Parameters:
Name Type Description
value string Hexadecimal string representing color. This string must be prepended with '#' character.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setColor) {
    mark.setColor("#FF0000"); // set the mark's color to red
}

setData(key, value) → {IPCC.Mark}

Sets the data value for the given key. This method is defined on all Mark objects. **Notes:** - Overwrites any data value already associated with the given key. - There is no artificial limit imposed on the number of key-value pairs that are stored. - If limits on the number of KVPs are required, they should be enforced by calling code. - Setting the value as undefined results in no information for the key being persisted to the server. - The returned data is not mutated or sanitized, which could lead to a security vulnerability if not sanitized properly before use.
Parameters:
Name Type Description
key string The key for which to set the data value.
value string This is the value to set for the key. - This must be a string or undefined. - The maximum length of the string is not limited by this function.
See:
Returns:
The Mark object on which the method was called.
Type
IPCC.Mark
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// Get data returns undefined before the key is set.
mark.getData("Author"); // returns undefined

// The key "Author" is set the value "Mark".
mark.setData("Author", "Mark");
mark.getData("Author"); // returns "Mark"

// The key "Author" is overwritten with the value "Clark".
mark.setData("Author", "Clark");
mark.getData("Author"); // returns "Clark"

// The key "Author" is unset, by setting the value to undefined.
mark.setData("Author", undefined);
mark.getData("Author"); // returns undefined

// The value can only be set to a string or undefined.
// All other data types throw.
mark.setData("FooBar", null); // throws
mark.setData("FooBar", 1);    // throws
mark.setData("FooBar", true); // throws
mark.setData("FooBar", {});   // throws
mark.setData("FooBar", []);   // throws

setEndHeadType(value) → {IPCC.Mark}

Sets the line head type. This method is defined on marks of type: `LineAnnotation`.
Parameters:
Name Type Description
value IPCC.Mark.LineHeadType The line head type. For example, `IPCC.Mark.LineHeadType.FilledRectangle` can be specified to make the line appear as an arrow.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setEndHeadType) {
    // Put a triangle head on the end of the line to make it an arrow
    mark.setEndHeadType("FilledTriangle");
    // or use the enumeration to accomplish the same thing
    mark.setEndHeadType(IPCC.Mark.LineHeadType.FilledTriangle);
}

setEndPoint(value) → {IPCC.Mark}

Sets the end point coordinate of the line Mark. This method is defined on marks of type: `LineAnnotation`.
Parameters:
Name Type Description
value Object Start point coordinates of a line Mark. The parameter object must be of the following type: `{x: xvalue, y: yvalue}`
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setEndPoint) {
    mark.setEndPoint({x:100, y:100});
}

setFillColor(value) → {IPCC.Mark}

Sets the fill color of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
Parameters:
Name Type Description
value string Hexadecimal string representing fill color. This string must be prepended with '#' character.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFillColor) {
    mark.setFillColor("#FF0000"); // set the fill color to red
}

setFillVisible(value) → {IPCC.Mark}

Sets the fill visible property of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `PolygonAnnotation`.
Parameters:
Name Type Description
value boolean representing fill visible property.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFillVisible) {
    mark.setFillVisible(false); // set the filling of mark as false
}

setFontColor(value) → {IPCC.Mark}

Sets the font color of the text in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value string A string value containing the hexadecimal color for the text of the text annotation.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFontColor) {
    mark.setFontColor("#000000");
}

setFontName(value) → {IPCC.Mark}

Sets the font name of the text in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value string A string value containing the font name for the text in the text annotation.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFontName) {
    mark.setFontName("Aerial");
}

setFontSize(value) → {IPCC.Mark}

Sets the font size (in points) for the text to use in the Mark. **Note:** The API uses the resolution of the image to determine the size of a point so, for example, a line of 12 point text on a 300 DPI raster image will be 12 points / 72 point-per-inch * 300 pixels-per-inch = 50 pixels tall. The default value is 12 points. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value number A number for the font size for the text in the text annotation.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFontSize) {
    mark.setFontSize(12);
}

setFontStyle(value) → {IPCC.Mark}

Sets the font styles provided in the parameter array of the text in the mark. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value Array.<string> An array containing values containing the font styles for the text in the text annotation. Valid values in the array are: - "Bold" (IPCC.Mark.FontStyles.Bold) - "Italic" (IPCC.Mark.FontStyles.Italic) - "Underline" (IPCC.Mark.FontStyles.Underline) - "Strikeout" (IPCC.Mark.FontStyles.Strikeout) **Note:** An empty array would render the text with normal font style.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setFontStyle) {
    var fontStylesArray = ["Bold","Italic","Underline"];
    mark.setFontStyle(fontStylesArray);
}

setHorizontalAlignment(value) → {IPCC.Mark}

Sets the horizontal alignment of the text in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value string A string value containing the horizontal alignment for the text in the text annotation.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setHorizontalAlignment) {
    mark.setHorizontalAlignment("center");
}

setInteractionMode(interactionMode) → {IPCC.ViewerControl}

Sets a value that indicates the allowed interactions with this mark. This method is defined on all Mark objects.
Parameters:
Name Type Description
interactionMode string A string value from the enumeration IPCC.Mark.InteractionMode, which indicates the allowed interactions with this mark.
See:
Returns:
The object on which this method was called.
Type
IPCC.ViewerControl
Example
mark.setInteractionMode(IPCC.Mark.InteractionMode.Full);

setLineStyle(value) → {IPCC.Mark}

Sets the border line style of the Mark. This method is defined on marks of type: `PolylineAnnotation`, and `PolygonAnnotation`.
Parameters:
Name Type Description
value int Enumeration value representing the line style.
See:
  • IPCC.Web.UI.LineStyle
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setLineStyle) {
    mark.setLineStyle(4); // set the line style to dash-dot-dot
}

setMaxLength(maxLength) → {IPCC.Mark}

Sets the maximum number of characters that may be entered into an input This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
maxLength number The positive number to set as the max length of the mark
See:
Throws:
If `maxLength` is not a positive integer or 0.
Type
Error
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setMaxLength) {
    // only allow 5 characters to be entered
    mark.setMaxLength(5);
}

setOpacity(value) → {IPCC.Mark}

Sets the opacity of the Mark. This value is a number between 0 and 255. This method is defined on marks of type: `LineAnnotation`, `RectangleAnnotation`, `EllipseAnnotation`, `TextAnnotation`, and `PolylineAnnotation`.
Parameters:
Name Type Description
value number Opacity of the Mark. Acceptable values are in the range 0 to 255.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setOpacity) {
    mark.setOpacity(255); // fully opaque
    mark.setOpacity(127); // translucent
    mark.setOpacity(0);   // transparent
}

setPoints(value) → {IPCC.Mark}

Sets the points vertices coordinate array of the PolylineAnnotation Mark. This method is defined on marks of type: `PolylineAnnotation`.
Parameters:
Name Type Description
value Object is an array of coordinates of the vertices in a Polyline Mark. Each point must be of the following type: `{x: xvalue, y: yvalue}`
See:
Throws:
If `value` is not an array.
Type
Error
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setPoints) {
    mark.setPoints([{x:100, y:100}, {x:200, y: 250}..., {x:1000, y: 1000});
}

setRectangle(value) → {IPCC.Mark}

Sets the bounding rectangle of the Mark. This method is defined on marks of type: `RectangleAnnotation`, `EllipseAnnotation` and `TextAnnotation`.
Parameters:
Name Type Description
value Object Bounding rectangle of a Mark. The parameter object must be of the following type: `{x: xValue, y: yValue, width: widthValue, height: heightValue}`
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setRectangle) {
    mark.setRectangle({x:0, y:0, width:100, height:100});
}

setSessionData(key, value) → {IPCC.Mark}

Sets the session data value for the given key. Unlike IPCC.Mark#setData, this data is not saved with the annotation, it only lasts for the session. This method is defined on all Mark objects.
Parameters:
Name Type Description
key string The key for which to set the data value.
value string This is the value to set for the key. - This must be a string or undefined. - The maximum length of the string is not limited by this function.
See:
Returns:
The Mark object on which the method was called.
Type
IPCC.Mark
Example
var mark = viewerControl.addMark(1, "RectangleAnnotation");

// Get data returns undefined before the key is set.
mark.getSessionData("Visibility"); // returns undefined

// The key "Visibility" is set the value "Shown".
mark.setSessionData("Visibility", "Shown");
mark.getSessionData("Visibility"); // returns "Shown"

// The key "Visibility" is overwritten with the value "Hidden".
mark.setSessionData("Visibility", "Hidden");
mark.getSessionData("Visibility"); // returns "Hidden"

// The key "Visibility" is unset, by setting the value to undefined.
mark.setSessionData("Visibility", undefined);
mark.getSessionData("Visibility"); // returns undefined

// The value can only be set to a string or undefined.
// All other data types throw.
mark.setSessionData("FooBar", null); // throws
mark.setSessionData("FooBar", 1);    // throws
mark.setSessionData("FooBar", true); // throws
mark.setSessionData("FooBar", {});   // throws
mark.setSessionData("FooBar", []);   // throws

setStartPoint(value) → {IPCC.Mark}

Sets the start point coordinate of the line Mark. This method is defined on marks of type: `LineAnnotation`.
Parameters:
Name Type Description
value Object Start point coordinates of a line Mark. The parameter object must be of the following type: {x:xvalue, y: yvalue}
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setStartPoint) {
    mark.setStartPoint({x:1, y:1});
}

setText(value) → {IPCC.Mark}

Sets the text in the Text Mark. This method is defined on marks of type: `TextAnnotation`.
Parameters:
Name Type Description
value string Text of the Mark. Acceptable values are any string.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setText) {
    mark.setText("This is test Text");
}

setThickness(value) → {IPCC.Mark}

Sets the thickness of line. This method is defined on marks of type: `LineAnnotation` and `PolylineAnnotation`.
Parameters:
Name Type Description
value number Thickness of the line.
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setThickness) {
    mark.setThickness(3);
}

setVisible() → {IPCC.Mark}

Sets the Mark to either visible or invisible depending on the boolean parameter. This method is defined on all mark types.
Parameters:
Name Type Description
value. boolean
See:
Returns:
The Mark object on which this method was called.
Type
IPCC.Mark
Example
if (mark.setVisible) {
    mark.setVisible(true); // sets the mark visible
}

Type Definitions

ImageData

This type is used to specify the image data and a unique identifier for the image data. Objects of this type are used by the IPCC.Mark#getImage, IPCC.Mark#setImage, and IPCC.Mark#image members.
Type:
  • Object
Properties:
Name Type Description
id string An arbitrary string id used to identify this image. Though this can be any string, it is expected that the same string identifier be used to identify the same image data.
dataUrl string A base64-encoded data URL representation of an image.