Constructor
new Mark(parameters)
NOTE: this constructor is for internal use only.
To programmatically add a Mark (an annotation or redaction) to a document, use PCCViewer.ViewerControl#addMark.
Example
var viewerControl = new PCCViewer.ViewerControl(...);
// use PCCViewer.ViewerControl#addMark(pageNumber, markType) to create
// and add a mark instead of new Mark()
viewerControl.addMark(1, "LineAnnotation");
Parameters:
Name | Type | Description |
---|---|---|
parameters |
Object |
The parameters object takes the following properties:
|
Members
(static, readonly) FontStyles :string
The PCCViewer.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).
Example
// use the enumeration to make text Bold
mark.setFontStyle([PCCViewer.Mark.FontStyles.Bold]);
// or just use the string value. Note: The parameter should be an array of styles required.
mark.setFontStyle(["Bold"]);
Type:
- string
Properties:
Name | 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. |
(static, readonly) HorizontalAlignment :string
The PCCViewer.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).
Example
// use the enumeration to make text centered
mark.setHorizontalAlignment(PCCViewer.Mark.HorizontalAlignment.Center);
// or just use the string value
mark.setHorizontalAlignment("Center");
Type:
- string
Properties:
Name | 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. |
(static, readonly) InteractionMode :string
The PCCViewer.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).
Example
// use the enumeration to make the mark non-selectable
mark.setInteractionMode(PCCViewer.Mark.InteractionMode.SelectionDisabled);
// or just use the string value of the enumeration
mark.setInteractionMode("SelectionDisabled");
Type:
- string
Properties:
Name | 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:
(static, readonly) LineHeadType :string
The PCCViewer.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).
Example
// use the enumeration to make a line an arrow
myLineAnnotation.setEndHeadType(PCCViewer.Mark.LineHeadType.FilledTriangle);
// or just use the string value
myLineAnnotation.setEndHeadType("FilledTriangle");
Type:
- string
Properties:
Name | Description |
---|---|
None : string |
No line head. |
FilledTriangle : string |
A filled triangle line head. Note: this makes the line an arrow. :) |
(static, readonly) Type :string
The PCCViewer.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).
Example
// use the enumeration to make a line annotation
myViewerControl.addMark(1, PCCViewer.Mark.Type.LineAnnotation);
// or just use the string value
myViewerControl.addMark(1, "LineAnnotation");
Type:
- string
Properties:
Name | 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: |
RectangleAnnotation : string |
This mark is drawn as a rectangle on the document. The properties specific for this are: |
EllipseAnnotation : string |
This mark is drawn as an ellipse on the document. The properties specific for this are: |
TextAnnotation : string |
This mark is drawn as text on the document. The text has a background and border. The properties specific for this are: The methods specific for this are: |
StampAnnotation : string |
This mark is drawn as a stamp on the document. A stamp has a label (text) and a border. The properties specific for this are: |
HighlightAnnotation : string |
This mark is drawn as a text highlight on the document. The properties specific for this are: The methods specific for this are: |
RectangleRedaction : string |
This mark is drawn as a rectangle on the document. The properties specific for this are: |
TransparentRectangleRedaction : string |
This mark is drawn as a transparent rectangle on the document. The color is always yellow and the opacity is always 50% (127/255). The properties specific for this are: |
TextHyperlinkAnnotation : string |
This mark is drawn as a text hyperlink on the document. The properties specific for this are: The methods specific for this are: |
TextRedaction : string |
This mark is drawn as a rectangle on the document. This redaction can be burned into the document. The properties specific for this are: The methods specific for this are: |
StampRedaction : string |
This mark is drawn as a stamp on the document. This redaction can be burned into the document. The properties specific for this are: |
FreehandAnnotation : string |
This mark is drawn as a freehand line on the document. The properties specific for this are: |
FreehandSignature : string |
This mark is drawn as a signature on the document and is confined to a rectangle. The properties specific for this are: |
TextSignature : string |
This mark is drawn as a text signature on the document and is confined to a rectangle. The user cannot edit the text of the mark. The only way to edit the text of this mark is programmatically. The properties specific for this are: |
TextInputSignature : string |
This mark is drawn as a single line of text that auto-fits to the containing rectangle. The user can interact with the mark using the mouse, touch-screen, and keyboard in order to set the text and adjust the rectangle. The properties specific for this are: |
TextAreaSignature : string |
This mark is drawn as a text area that auto-fits to the containing rectangle. The user can interact with the mark using the mouse, touch-screen, and keyboard in order to set the text and adjust the rectangle. The properties specific for this are: |
TextSelectionRedaction : string |
This mark is drawn as a text highlight redaction on the document. The properties specific for this are: The methods specific for this are: |
ImageStampAnnotation : string |
This mark is drawn as an ImageStamp annotation on the document. The properties specific for this are: |
ImageStampRedaction : string |
This mark is drawn as an ImageStamp redaction on the document. The properties specific for this are: |
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: |
StrikethroughAnnotation : string |
This mark is drawn as a Strikethrough annotation on the document. The annotation itself is just a line that is placed over the specified text. The properties specific for this are: The methods specific for this are: |
borderColor :string
Gets or sets the border color of the Mark.
This property is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
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.
Example
if ('borderColor' in mark) {
var oldValue = mark.borderColor;
mark.borderColor = "#FF0000"; // set border color to red
}
Type:
- string
borderThickness :number
Gets or sets the border thickness of the Mark.
This property is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
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.
Example
if ('borderThickness' in mark) {
var oldValue = mark.borderThickness;
mark.borderThickness = 3; // set the border thickness of the mark
}
Type:
- number
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.
Example
var boundingRectangle = mark.boundingRectangle;
Type:
- Object
color :string
Gets or sets the color of the Mark.
This property is defined on marks of type: LineAnnotation
, StampAnnotation
, FreehandAnnotation
, FreehandSignature
, TextSignature
, PolylineAnnotation
and StrikethroughAnnotation
.
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.
Example
if ('color' in mark) {
var oldValue = mark.color;
mark.color = "#FF0000"; // set color to red
}
Type:
- string
(readonly) conversation :PCCViewer.Conversation
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.
Example
var conversation = mark.conversation;
Type:
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.
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";
}
Type:
- string
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.
Example
if ('endPoint' in mark) {
var oldValue = mark.endPoint;
mark.endPoint = {x: 100, y: 100}; // set the end point to (100, 100)
}
Type:
- Object
fillColor :string
Gets or sets the fill color of the Mark.
This property is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, HighlightAnnotation
, TextHyperlinkAnnotation
and RectangleRedaction
.
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.
Example
if ('fillColor' in mark) {
var oldValue = mark.fillColor;
mark.fillColor = "#FF0000"; // set color to red
}
Type:
- string
fontColor :string
Gets or sets the font color of the text in the Mark.
This property is defined on marks of type: TextAnnotation
, TextRedaction
, TextInputSignature
, RectangleRedaction
and TextAreaSignature
.
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.
Example
if ('fontColor' in mark) {
var oldValue = mark.fontColor;
mark.fontColor = "#ffccbb";
}
Type:
- string
fontName :string
Gets or sets the font name of the text in the Text Mark.
This property is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, TextAreaSignature
.
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.
Example
if ('fontName' in mark) {
var oldValue = mark.fontName;
mark.fontName = "Aerial";
}
Type:
- string
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
, TextRedaction
.
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.
Example
if ('fontSize' in mark) {
var oldValue = mark.fontSize;
mark.fontSize = 12;
}
Type:
- number
fontStyle :Array.<string>
Gets or sets the font Style of the text in the mark.
This property is defined on marks of type: TextRedaction
, TextAreaSignature
, 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.
Example
if ('fontStyle' in mark) {
var oldValue = mark.fontStyle;
mark.fontStyle = ["Bold",Underline,Italic];
}
Type:
- Array.<string>
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
, TextRedaction
, FreehandSignature
, TextSignature
, TextInputSignature
and TextAreaSignature
.
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.
Example
if ('horizontalAlignment' in mark) {
var oldValue = mark.horizontalAlignment;
mark.horizontalAlignment = "left";
}
Type:
- string
- See:
href :string
Gets or sets the link target for hyperlink annotations.
All strings and numbers are valid values. It is the responsibility of the API consumer to handle clicks of hyperlink annotations. When handling the click, the API consumer should interpret the href value and take the appropriate navigation action.
This property is defined on marks of type: TextHyperlinkAnnotation
.
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.
Example
if ('href' in mark) {
var oldValue = mark.href;
mark.href = "http://www.accusoft.com/";
}
Type:
- string
(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.
Example
var id = mark.id;
Type:
- string
- See:
image :PCCViewer.Mark~ImageData
Gets the image that is displayed for the Mark.
This property is defined on marks of type: ImageStampAnnotation
and ImageStampRedaction
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.
Example
if ('image' in mark) {
// get old image data
var oldImageData = mark.image;
// set new image
mark.image = {
dataUrl: "data:image/png;base64,base64 string",
id: "myUniqueImageIDABC123"
};
}
Type:
interactionMode :string
Gets or sets a value that indicates the allowed interactions with the mark. Possible values are defined in the enumeration PCCViewer.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.
Example
// get
var interactionMode = mark.interactionMode;
// set
mark.interactionMode = PCCViewer.Mark.InteractionMode.SelectionDisabled;
Type:
- string
label :string
Gets or sets the text in the Stamp Mark.
This property is defined on marks of type: StampAnnotation
, StampRedaction
.
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.
Example
if ('label' in mark) {
var oldValue = mark.label;
mark.label = "Approved";
}
Type:
- string
mask :object
Gets or sets the mask for text input signatures.
This property is defined on marks of type: TextInputSignature
.
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.
Example
if ('mask' in mark) {
var oldValue = mark.mask;
mark.mask = {
value: '(###) ###-####',
translations: {
'#': /\d/
}
};
}
Type:
- object
maxFontSize :number
Gets or sets a value that determines the maximum font size for a mark.
This method is defined on marks of type: TextAreaSignature
and TextInputSignature
.
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.
Example
// get
var maxFontSize = mark.maxFontSize;
// set
mark.maxFontSize = 13;
Type:
- number
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
, TextRedaction
, TextAreaSignature
and TextInputSignature
.
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.
Example
// get
var maxLength = mark.maxLength;
// set
mark.maxLength = 13;
Type:
- number
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
,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.
Example
if ('opacity' in mark) {
var oldValue = mark.opacity;
mark.opacity = 127; // set the opacity so that the mark is transparent
}
Type:
- number
(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.
Example
var pageNumber = mark.pageNumber;
Type:
- number
path :string
Gets or sets the path data of FreehandSignature and FreehandAnnotation.
This property is defined on marks of type: FreehandSignature
, FreehandAnnotation
.
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.
Example
if ('path' in mark) {
var oldValue = mark.path;
mark.path = "M0,0L1,1L1,0";
}
Type:
- string
points :Object
Gets or sets the array of points that make up coordinates of the vertices of the PolylineAnnotation Mark.
This property is defined on marks of type: 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.
Example
if ('points' in mark) {
var points = mark.points;
}
Type:
- Object
position :Object
Gets or sets the position of the Mark.
Important - The setter only works if the ViewerControl instance has page text for all pages that the text-based mark will span. See PCCViewer.Mark#setPosition for complete information on safely setting the mark's position.
This property is defined on marks of type: HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
, and StrikethroughAnnotation
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.
Example
// Basic usage.
if ('position' in mark) {
var oldValue = mark.position;
// Requesting page text ensures that the ViewerControl has page text for the page (which
// is a pre-requisite) and it also gives us the page text so that we have context when
// setting the position.
viewerControl.requestPageText(1).then(function(pageText) {
// It is unsafe to set the mark position without first
mark.position = {startIndex: 0, length: pageText.length};
});
}
Type:
- Object
reason :string
Gets or sets the reason in the Mark.
This property is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
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.
Note: Throws an error if the ViewerControlOptions.enableMultipleRedactionReasons
property was set to true
when initializing ViewerControl
. In such case you should use the PCCViewer.Mark#reasons instead.
Example
if ('reason' in mark) {
var oldValue = mark.reason;
mark.reason = "Information for top security clearance only.";
}
Type:
- string
reasons :Array.<string>
Gets or sets the reasons in the Mark.
This property is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
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.
Note: Throws an error if the ViewerControlOptions.enableMultipleRedactionReasons
property was set to false
when initializing ViewerControl
. In such case you should use the PCCViewer.Mark#reason instead.
Example
if ('reasons' in mark) {
var oldValue = mark.reasons;
mark.reasons = ["1.a", "2.b", "Private Information"];
}
Type:
- Array.<string>
rectangle :Object
Gets or sets the bounding rectangle of the Mark.
This property is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, StampAnnotation
, RectangleRedaction
, TransparentRectangleRedaction
, TextRedaction
, StampRedaction
, FreehandAnnotation
, FreehandSignature
, TextSignature
, ImageStampAnnotation
, ImageStampRedaction
, TextInputSignature
and TextAreaSignature
.
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.
Example
if ('rectangle' in mark) {
var oldValue = mark.rectangle;
mark.rectangle = {x: 0, y: 0, width: 100, height: 100};
}
Type:
- Object
signature :string
Note: This property is defined on the template mark of the PlaceSignature
mouse tool, and is not available on any mark.
Gets or sets the template signature.
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
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.
Example
if ('startPoint' in mark) {
var oldValue = mark.startPoint;
mark.startPoint = {x: 1, y: 1}; // set the start point to (1, 1)
}
Type:
- Object
text :string
Gets or sets the text in the Mark.
This property is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, TextAreaSignature
HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
and StrikethroughAnnotation
.
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.
Example
if ('text' in mark) {
var oldValue = mark.text;
mark.text = "This is a Test";
}
Type:
- string
thickness :number
Gets or sets the thickness of the Mark.
This property is defined on marks of type: LineAnnotation
, FreehandAnnotation
, FreehandSignature
, 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.
Example
if ('thickness' in mark) {
var oldValue = mark.thickness;
mark.thickness = 3; // set the thickness of the mark
}
Type:
- number
(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.
Example
switch (mark.type) {
case Mark.Type.LineAnnotation:
...
break;
default:
...
}
Type:
- string
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.
Example
if ('visible' in mark) {
var oldValue = mark.visible;
mark.visible = true; // set mark to visible
}
Type:
- string
Methods
clearHighlights() → {PCCViewer.Mark}
Clears any text highlights within the mark object. The text highlights would have been created with PCCViewer.Mark#highlightText.
It is invalid to call this method on the template mark of a PCCViewer.MouseTool object.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
, and StrikethroughAnnotation
.
Example
if (mark.clearHighlights) {
mark.clearHighlights();
}
Throws:
-
-
If the mark is the template mark of a PCCViewer.MouseTool object.
- Type
- Error
-
-
-
If the mark was created with the constructor new Mark().
- Type
- Error
-
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
getBorderColor() → {string}
Gets the border color of the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
Example
if (mark.getBorderColor) {
var borderColor = mark.getBorderColor();
}
Returns:
The border color of the Mark as a hexadecimal string.
- Type
- string
getBorderThickness() → {number}
Gets the border thickness of the mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
Example
if (mark.getBorderThickness) {
var borderThickness = mark.getBorderThickness();
}
Returns:
The border thickness of the mark.
- Type
- number
getBoundingRectangle() → {Object}
Gets the bounding rectangle for the Mark.
This method is defined on all Mark objects.
Example
var boundingRectangle = mark.getBoundingRectangle();
Returns:
A rectangle object of the type {x: xValue, y: yValue, width: widthValue, height: heightValue}
.
- Type
- Object
getColor() → {string}
Gets the color of the Mark.
This method is defined on marks of type: LineAnnotation
, StampAnnotation
, FreehandAnnotation
, FreehandSignature
, TextSignature
, PolylineAnnotation
and StrikethroughAnnotation
.
Example
if (mark.getColor) {
var color = mark.getColor();
}
Returns:
The color of the Mark as a hexadecimal string.
- Type
- string
getConversation() → {PCCViewer.Conversation}
Gets the conversation associated with the Mark.
This method is defined on all Mark objects.
Returns:
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.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// 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
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
The key for which to get the data value. |
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
getDataKeys() → {Array.<string>}
Gets an array of data keys known to this Mark.
This method is defined on all Mark objects.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// Returns an empty array before key-value pairs 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"]
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>
getEndHeadType() → {string|PCCViewer.Mark.LineHeadType}
Gets the line Mark end head type.
This method is defined on marks of type: LineAnnotation
.
Example
if (mark.getEndHeadType) {
var endHeadType = mark.getEndHeadType();
}
Returns:
A line head type enum value.
- Type
- string | PCCViewer.Mark.LineHeadType
getEndPoint() → {Object}
Gets the end point coordinates of the line Mark.
This method is defined on marks of type: LineAnnotation
.
Example
if (mark.getEndPoint) {
var endPoint = mark.getEndPoint();
}
Returns:
A point object of the type {x: xvalue, y: yvalue}
- Type
- Object
getFillColor() → {string}
Gets the fill color of the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, HighlightAnnotation
, TextHyperlinkAnnotation
and RectangleRedaction
.
Example
if (mark.getFillColor) {
var fillColor = mark.getFillColor();
}
Returns:
The fill color of the Mark as a hexadecimal string.
- Type
- string
getFontColor() → {string}
Gets the font color of the text contained in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextInputSignature
, RectangleRedaction
and TextAreaSignature
.
Example
if (mark.getFontColor) {
var text = mark.getFontColor();
}
Returns:
The text contained in the Text mark.
- Type
- string
getFontName() → {string}
Gets the font color of the text contained in the Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.getFontName) {
var text = mark.getFontName();
}
Returns:
The text contained in the Text mark.
- Type
- string
getFontSize() → {number}
Gets the font size (in points) of the text in the Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
.
Example
if (mark.getFontSize) {
var fontSize = mark.getFontSize();
}
Returns:
The font size of the text in the text mark.
- Type
- number
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
, TextAreaSignature
, TextRedaction
.
Example
if (mark.getFontStyle) {
var fontStyleArray = mark.getFontStyle();
}
Returns:
An array containing the font styles of text contained in the Text mark.
- Type
- Array.<string>
getHorizontalAlignment() → {string}
Gets the horizontalAlignment of the text contained in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, FreehandSignature
, TextSignature
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.getHorizontalAlignment) {
var horizontalAlignment = mark.getHorizontalAlignment();
}
- See:
Returns:
A string containing horizontalAlignment contained in the Text mark.
- Type
- string
getHref() → {string|number}
Gets the link target for hyperlink annotations.
This method is defined on marks of type: TextHyperlinkAnnotation
.
Example
if (mark.getHref) {
var href = mark.getHref();
switch (typeof href) {
case "number":
// navigate to the page
viewerControl.setPageNumber(href);
break;
case "string":
// Interpret the URL and execute the navigation.
window.location.href = href;
break;
case "undefined":
case "object":
default:
// do nothing, or define some special rules
break;
}
}
Returns:
The link target.
- Type
- string | number
getId() → {string}
Gets the ID of the Mark.
This method is defined on all Mark objects.
Example
var markId = mark.getId();
- See:
Returns:
The ID of the Mark.
- Type
- string
getImage() → {PCCViewer.Mark~ImageData}
Gets the image that is displayed for the Mark.
This method is defined on marks of type: ImageStampAnnotation
and ImageStampRedaction
.
Example
if (mark.getImage) {
var imageData = mark.getImage();
}
Returns:
An object that represents the image to be shown for the mark.
getInteractionMode() → {string}
Gets a value that indicates the allowed interactions with this mark.
This method is defined on all Mark objects.
Example
var interactionMode = mark.getInteractionMode();
Returns:
A string value from the enumeration PCCViewer.Mark.InteractionMode, which indicates the allowed interactions with this mark.
- Type
- string
getLabel() → {string}
Gets the text string contained in the Stamp Mark.
This method is defined on marks of type: StampAnnotation
, StampRedaction
.
Example
if (mark.getLabel) {
var label = mark.getLabel();
}
Returns:
The text string in the Stamp mark.
- Type
- string
getMask() → {object}
Gets the applied mask for the text input signature mark.
This method is defined on marks of type: TextInputSignature
.
Example
if (mark.getMask) {
var mask = mark.getMask();
}
Returns:
The mask for the mark.
- Type
- object
getMaxFontSize() → {Number}
Gets the maximum font size (in points) for text in the mark.
This method is defined on marks of type: TextAreaSignature
and TextInputSignature
.
Example
if (mark.getMaxFontSize) {
var mask = mark.getMaxFontSize();
}
Returns:
The maximum font size of the mark.
- Type
- Number
getMaxLength() → {Number}
Gets the applied max length for the mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextAreaSignature
and TextInputSignature
.
Example
if (mark.getMaxLength) {
var mask = mark.getMaxLength();
}
Returns:
The max length for the mark.
- Type
- Number
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
.
Example
if (mark.getOpacity) {
var opacity = mark.getOpacity();
}
Returns:
The opacity of the line.
- Type
- number
getPageNumber() → {number}
Gets the page number where the Mark object is located.
This method is defined on all Mark objects.
Example
var pageNumber = mark.getPageNumber();
Returns:
The page number where the Mark is located.
- Type
- number
getPath() → {string}
Gets the path data for FreehandSignature and FreehandAnnotation.
This method is defined on marks of type: FreehandSignature
, FreehandAnnotation
.
Example
if (mark.getPath) {
var path = mark.getPath();
}
Returns:
The path data string.
- Type
- string
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
.
Example
if (mark.getPoints) {
var points = mark.getPoints();
}
Returns:
of point objects of the type {x: xvalue, y: yvalue}
- Type
- Array
getPosition() → {Object}
Gets the position of the text-based Mark.
This method is defined on marks of type: HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
, and StrikethroughAnnotation
.
Example
if (mark.getPosition) {
var position = mark.getPosition();
}
Returns:
A position object of the type {startIndex: startIndexValue, length: lengthValue}
.
- Type
- Object
getReason() → {string}
Gets the reason contained in the Redaction Mark.
This method is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
Example
if (mark.getReason) {
var reason = mark.getReason();
}
Throws:
-
If the ViewerControlOptions.
enableMultipleRedactionReasons
property was set totrue
when initializingViewerControl
. In such case you should use the PCCViewer.Mark#getReasons instead.- Type
- Error
Returns:
The reason contained in the Redaction mark.
- Type
- string
getReasons() → {Array.<string>}
Gets the reasons contained in the Redaction Mark.
This method is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
Example
if (mark.getReasons) {
var reasons = mark.getReasons();
}
Throws:
-
If the ViewerControlOptions.
enableMultipleRedactionReasons
property was set tofalse
when initializingViewerControl
. In such case you should use the PCCViewer.Mark#getReason instead.- Type
- Error
Returns:
The reasons contained in the Redaction mark.
- Type
- Array.<string>
getRectangle() → {Object}
Gets the bounding rectangle for the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, StampAnnotation
, RectangleRedaction
, TransparentRectangleRedaction
, TextRedaction
, StampRedaction
, FreehandAnnotation
, FreehandSignature
, TextSignature
, ImageStampAnnotation
, ImageStampRedaction
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.getRectangle) {
var boundingRectangle = mark.getRectangle();
}
Returns:
An object of the type {x: xValue, y: yValue, width: widthValue, height: heightValue}
describing the rectangle in pixels.
- Type
- Object
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 PCCViewer.Mark#getData, this data is not saved with the annotation, it only lasts for the session.
This method is defined on all Mark objects.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// 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
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
getSessionDataKeys() → {Array.<string>}
Gets an array of data keys known to this Mark. Unlike PCCViewer.Mark#getDataKeys, this data is not saved with the annotation, it only lasts for the session.
This method is defined on all Mark objects.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// Returns an empty array before key-value pairs 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"]
- 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>
getSignature() → {Object|undefined}
Note: This property is defined on the template mark of the PlaceSignature
mouse tool, and is not available on any mark.
Gets the last signature object that was associated with the particular template mark.
Example
// get the mouse tool
var accusoftPlaceSignature = PCCViewer.MouseTools.getMouseTool('AccusoftPlaceSignature');
// get the template mark
var signatureTemplateMark = accusoftPlaceSignature.getTemplateMark();
// get the signature associated with the template
var signature = signatureTemplateMark.getSignature();
Returns:
The PlaceSignature
object, or undefined
. See PCCViewer.Signatures~FreehandSignature and PCCViewer.Signatures~TextSignature.
- Type
- Object | undefined
getStartPoint() → {Object}
Gets the start point coordinates of the line Mark.
This method is defined on marks of type: LineAnnotation
.
Example
if (mark.getStartPoint) {
var startPoint = mark.getStartPoint();
}
Returns:
A point object of the type {x: xvalue, y: yvalue}
- Type
- Object
getText() → {string}
Gets the text contained in marks with text or text-selection based marks.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
, TextInputSignature
, StrikethroughAnnotation
and TextAreaSignature
.
Example
if (mark.getText) {
var text = mark.getText();
}
Returns:
The text contained in the in the above mentioned mark types.
- Type
- string
getThickness() → {number}
Gets the thickness of the line.
This method is defined on marks of type: LineAnnotation
, FreehandAnnotation
, FreehandSignature
,PolylineAnnotation
, StrikethroughAnnotation
.
Example
if (mark.getThickness) {
var thickness = mark.getThickness();
}
Returns:
The thickness of the line.
- Type
- number
getType() → {string}
Gets the type of the Mark type.
This method is defined on all Mark objects.
Example
switch (mark.getType()) {
case Mark.Type.LineAnnotation:
...
break;
default:
...
}
- See:
-
- PCCViewer.Mark.Type for a list of possible Mark types.
- PCCViewer.Mark.Type
- PCCViewer.Mark#type
Returns:
The type of Mark.
- Type
- string
getVisible() → {boolean}
Gets the visibility of the Mark.
This method is defined on all mark types.
Example
if (mark.getVisible) {
var visible = mark.getVisible();
}
Returns:
Returns true if the mark is visible, false otherwise.
- Type
- boolean
highlightText(highlights) → {PCCViewer.Mark}
Highlights text within the mark. The highlights are not persisted when mark is saved using saveMarkup.
Existing highlights that were created with a previous call to this method, are cleared when this method is called.
It is invalid to call this method on the template mark of a PCCViewer.MouseTool object.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
and StrikethroughAnnotation
.
Example
if (mark.highlightText) {
mark.highlightText([
{startIndex: 0, length: 5, color: "#FF0000"},
{startIndex: 10, length: 5, color: "#FF0000", opacity: 200}
]);
}
Parameters:
Name | Type | Description |
---|---|---|
highlights |
Array.<object> | object |
An array of objects or a single object that defines a highlight.
If passed a value of null, undefined, or an empty array, then the highlights are cleared. |
Throws:
-
-
If any of the highlights in
highlights
param are missing required properties or contain invalid data.- Type
- Error
-
-
-
If the mark is the template mark of a PCCViewer.MouseTool object.
- Type
- Error
-
-
-
If the mark was created with the constructor new Mark().
- Type
- Error
-
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setBorderColor(value) → {PCCViewer.Mark}
Sets the border color of the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
Example
if (mark.setBorderColor) {
mark.setBorderColor("#FF0000"); // set the border color to red
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Hexadecimal string representing border color. This string must be prepended with '#' character. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setBorderThickness(value) → {PCCViewer.Mark}
Sets the border thickness of the mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
and RectangleRedaction
.
Example
if (mark.setBorderThickness) {
mark.setBorderThickness(3);
}
Parameters:
Name | Type | Description |
---|---|---|
value |
number |
Border thickness of the mark. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setColor(value) → {PCCViewer.Mark}
Sets the color of the Mark.
This method is defined on marks of type: LineAnnotation
, StampAnnotation
, FreehandAnnotation
, FreehandSignature
, TextSignature
,PolylineAnnotation
and StrikethroughAnnotation
.
Example
if (mark.setColor) {
mark.setColor("#FF0000"); // set the mark's color to red
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Hexadecimal string representing color. This string must be prepended with '#' character. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setData(key, value) → {PCCViewer.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 key-value pairs 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.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// 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
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.
|
Returns:
The Mark object on which the method was called.
- Type
- PCCViewer.Mark
setEndHeadType(value) → {PCCViewer.Mark}
Sets the line head type.
This method is defined on marks of type: LineAnnotation
.
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(PCCViewer.Mark.LineHeadType.FilledTriangle);
}
Parameters:
Name | Type | Description |
---|---|---|
value |
PCCViewer.Mark.LineHeadType |
The line head type. For example, |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setEndPoint(value) → {PCCViewer.Mark}
Sets the end point coordinate of the line Mark.
This method is defined on marks of type: LineAnnotation
.
Example
if (mark.setEndPoint) {
mark.setEndPoint({x:100, y:100});
}
Parameters:
Name | Type | Description |
---|---|---|
value |
Object |
Start point coordinates of a line Mark. The parameter object must be of the following type: |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setFillColor(value) → {PCCViewer.Mark}
Sets the fill color of the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, HighlightAnnotation
, TextHyperlinkAnnotation
and RectangleRedaction
.
Example
if (mark.setFillColor) {
mark.setFillColor("#FF0000"); // set the fill color to red
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Hexadecimal string representing fill color. This string must be prepended with '#' character. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setFontColor(value) → {PCCViewer.Mark}
Sets the font color of the text in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextInputSignature
, RectangleRedaction
and TextAreaSignature
.
Example
if (mark.setFontColor) {
mark.setFontColor("#000000");
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
A string value containing the hexadecimal color for the text of the text annotation. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setFontName(value) → {PCCViewer.Mark}
Sets the font name of the text in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.setFontName) {
mark.setFontName("Aerial");
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
A string value containing the font name for the text in the text annotation. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setFontSize(value) → {PCCViewer.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
, TextRedaction
.
Example
if (mark.setFontSize) {
mark.setFontSize(12);
}
Parameters:
Name | Type | Description |
---|---|---|
value |
number |
A number for the font size for the text in the text annotation. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setFontStyle(value) → {PCCViewer.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
, TextAreaSignature
, TextRedaction
.
Example
if (mark.setFontStyle) {
var fontStylesArray = ["Bold","Italic","Underline"];
mark.setFontStyle(fontStylesArray);
}
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:
Note: An empty array would render the text with normal font style. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setHorizontalAlignment(value) → {PCCViewer.Mark}
Sets the horizontal alignment of the text in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, FreehandSignature
, TextSignature
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.setHorizontalAlignment) {
mark.setHorizontalAlignment("center");
}
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
- PCCViewer.Mark
setHref(href) → {PCCViewer.Mark}
Sets the link target for hyperlink annotations.
All strings and numbers are valid values. It is the responsibility of the API consumer to handle clicks of hyperlink annotations. When handling the click, the API consumer should interpret the href value and take the appropriate navigation action.
This method is defined on marks of type: TextHyperlinkAnnotation
.
Example
if (mark.setHref) {
// set to fully qualified URL
mark.setHref("http://www.accusoft.com/");
// or a URL fragment
mark.setHref("#named-annotation");
// or a numeric value
mark.setHref(4);
}
Parameters:
Name | Type | Description |
---|---|---|
href |
string | number |
The link target. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setImage(imageData) → {PCCViewer.Mark}
Sets the image that is displayed for the Mark.
This method is defined on marks of type: ImageStampAnnotation
and ImageStampRedaction
.
Example
var param = {
dataUrl: "data:image/png;base64,base64 string",
id: "imageId"
};
if (mark.setImage) {
mark.setImage(param);
}
Parameters:
Name | Type | Description |
---|---|---|
imageData |
PCCViewer.Mark~ImageData |
An object that represents the image to be shown for the mark. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setInteractionMode(interactionMode) → {PCCViewer.ViewerControl}
Sets a value that indicates the allowed interactions with this mark.
This method is defined on all Mark objects.
Example
mark.setInteractionMode(PCCViewer.Mark.InteractionMode.Full);
Parameters:
Name | Type | Description |
---|---|---|
interactionMode |
string |
A string value from the enumeration PCCViewer.Mark.InteractionMode, which indicates the allowed interactions with this mark. |
Returns:
The object on which this method was called.
setLabel(value) → {PCCViewer.Mark}
Sets the text string in the Stamp Mark.
This method is defined on marks of type: StampAnnotation
, StampRedaction
.
Example
if (mark.setLabel) {
mark.setLabel("Approved");
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
A string value containing the text in the Stamp annotation. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setMask(mask) → {PCCViewer.Mark}
Sets the mask for the text input signature mark. Once this mark enters edit mode, the user input will be masked according to the properties set using this method.
This method is defined on marks of type: TextInputSignature
.
Example
if (mark.setMask) {
// only allow a US phone number as input
mark.setMask({
value: '(###) ###-####'
translations: {
'#': /\d/
}
});
// only allow an Arizona driver's license number
mark.setMask({
value: 'A######-AA#####-#########-A########',
translations: {
'A': /[a-zA-Z]/,
'#': /\d/
}
});
}
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
mask |
object |
The mask to set on this mark to assist user input. Properties
|
Throws:
-
-
If
mask
is not an object, undefined or null.- Type
- Error
-
-
-
If
mask.value
is not a string.- Type
- Error
-
-
-
If
mask.translations
is not an object.- Type
- Error
-
-
-
If
mask.translations
contains a key with a string length not equal to 1.- Type
- Error
-
-
-
If
mask.translations
contains a value that is not a regular expression.- Type
- Error
-
-
-
If
mask.translations
contains a value that is a regular expression with flags.- Type
- Error
-
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setMaxFontSize(maxFontSize) → {PCCViewer.Mark}
Sets the maximum font size (in points) for text in the mark. Setting a value of 0 indicates no max font size (in this case, the text will enlarge to fit to the mark bounds no matter how large the mark is).
This method is defined on marks of type: TextAreaSignature
and TextInputSignature
.
Example
if (mark.setMaxFontSize) {
// only allow the font to enlarge to 72px
mark.setMaxFontSize(72);
}
Parameters:
Name | Type | Description |
---|---|---|
maxFontSize |
number |
The positive number to set as the maximum font size of the mark. |
Throws:
-
If
maxFontSize
is not a positive integer or 0.- Type
- Error
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setMaxLength(maxLength) → {PCCViewer.Mark}
Sets the maximum number of characters that may be entered into an input
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextAreaSignature
, and TextInputSignature
.
Example
if (mark.setMaxLength) {
// only allow 5 characters to be entered
mark.setMaxLength(5);
}
Parameters:
Name | Type | Description |
---|---|---|
maxLength |
number |
The positive number to set as the max length of the mark |
Throws:
-
If
maxLength
is not a positive integer or 0.- Type
- Error
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setOpacity(value) → {PCCViewer.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
, FreehandAnnotation
, PolylineAnnotation
.
Example
if (mark.setOpacity) {
mark.setOpacity(255); // fully opaque
mark.setOpacity(127); // semi-transparent
mark.setOpacity(0); // transparent
}
Parameters:
Name | Type | Description |
---|---|---|
value |
number |
Opacity of the Mark. Acceptable values are in the range 0 to 255. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setPath(path) → {PCCViewer.Mark}
Sets the path data of FreehandSignature and FreehandAnnotation.
This method is defined on marks of type: FreehandSignature
, FreehandAnnotation
.
Example
if (mark.setPath) {
mark.setPath("M0,0L1,1L1,0");
}
Parameters:
Name | Type | Description |
---|---|---|
path |
string |
The path data string. This includes a subset of the SVG path standard, including the M, L, and C commands only. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setPoints(value) → {PCCViewer.Mark}
Sets the points vertices coordinate array of the PolylineAnnotation Mark.
This method is defined on marks of type: PolylineAnnotation
.
Example
if (mark.setPoints) {
mark.setPoints([{x:100, y:100}, {x:200, y: 250}..., {x:1000, y: 1000});
}
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: |
Throws:
-
If
value
is not an array.- Type
- Error
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setPosition(value) → {PCCViewer.Mark}
Sets the position of text-based Marks.
Important - This method only works if the ViewerControl instance has page text for all pages that the text-based mark will span. In common use cases the ViewerControl will have text for these pages, however the ViewerControl API provides methods to check if it has text for a page and also to force it to get text for a page.
There are certain methods that force the ViewerControl to get text for a page or all pages.
- Calling PCCViewer.ViewerControl#requestPageText will force the ViewerControl to get text for a specified page if it does not already have the text for the page. This method also has the benefit of providing you with the page text, so that you are not blindly setting the position of the mark on the page.
- Calling PCCViewer.ViewerControl#search will force the viewer to get text for all pages by the time the search completes.
There are means to determine if the ViewerControl has text for a page.
- Calling PCCViewer.ViewerControl#isPageTextReady will synchronously indicate if the viewer has text for a page.
- The ViewerControl will trigger the PCCViewer.EventType.PageTextReady event when it gets text for a page.
This method is defined on marks of type: HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
, and StrikethroughAnnotation
.
Example
// Example 1
// ------------------------
// Basic (unsafe) usage, call setPosition and pass in an object with a startIndex and length.
if (mark.setPosition) {
mark.setPosition({startIndex:0, length:5});
}
// Example 2
// ------------------------
// Safe usage, request the page text and then highlight something within that page.
// This code highlights the half of the characters on the page.
viewerControl.requestPageText(1).then(
function(pageText) {
// Now that we have the page text for page 1,
// Add a HighlightAnnotation to page 1 and set the position of the highlight.
viewerControl.addMark(1, PCCViewer.Mark.Type.HighlightAnnotation)
.setPosition({startIndex: pageText.length / 4, length: pageText.length / 2});
});
// Example 3
// ------------------------
// Safe highlighting of arbitrary spans of text.
// We highlight 3000 characters starting at index 100 on page 2.
var markPage = 2,
markPosition = {startIndex: 100, length: 3000};
// Since the highlight will be 3000 characters, it may span multiple pages.
// We use a helper method to ensure that the ViewerControl has text for all pages that it will span.
ensureViewerControlHasPageText(viewerControl, markPage, markPosition)
.then(addHighlightAnnotation,
function(error) {
alert("Something went wrong when trying to get page text. " + (error.message ? error.message : error));
});
// This function uses the ViewerControl API to add a HighlightAnnotation.
// It will be called when ensureViewerControlHasPageText completes.
function addHighlightAnnotation() {
// Add the HighlightAnnotation using ViewerControl#addMark and then
// set the position and color of the highlight.
viewerControl.addMark(markPage, PCCViewer.Mark.Type.HighlightAnnotation)
.setPosition(markPosition)
.setFillColor("#FF0000");
// Scroll to the page containing the mark.
viewerControl.setPageNumber(markPage);
}
// A helper method to ensure that a ViewerControl instance has page text
// for all pages that a HighlightAnnotation or TextSelectionRedaction spans.
function ensureViewerControlHasPageText(viewerControl, markPageNumber, markPosition) {
// Calling ViewerControl#requestPageText will cause the ViewerControl to get text
// from the server if it does not already have it. This method also gives us the page
// text so we can check if the mark will extend to the next page.
return viewerControl.requestPageText(markPageNumber).then(
// If requestPageText promise is fulfilled, we compare the markPosition to the
// page text, and if necessary, recursively ensure text for the next page.
function(pageText) {
// Check for an invalid markPosition. The method setPosition will now allow the caller
// to crate a mark that starts after the last character on the page.
if (markPosition.startIndex >= pageText.length) {
throw new Error("Mark cannot start after last character on the page.");
}
// Determine if the highlight extends into the next page.
var remainingCharsOnPage = pageText.length - markPosition.startIndex;
var remainingCharsInHighlight = markPosition.length - remainingCharsOnPage;
var extendsToNextPage = remainingCharsInHighlight > 0;
// If the highlight extends to the next page, and we are not on the last page,
// then ensure the viewer has the text for the next page.
if (extendsToNextPage) {
if (markPageNumber < viewerControl.getPageCount()) {
return ensureViewerControlHasPageText(viewerControl, markPageNumber + 1,
{startIndex: 0, length: remainingCharsInHighlight});
}
// Mark#setPosition does not allow the mark to extend off of the document.
else {
throw new Error("Mark cannot extend off the document.")
}
}
}
)
}
Parameters:
Name | Type | Description |
---|---|---|
value |
Object |
Position of a Mark. The parameter object must be of the following type: |
Throws:
-
-
If the viewer does not have text for any page that the mark will span.
- Type
- Error
-
-
-
If
position.startIndex
is not a valid number that indicates the index of a character on the mark's page.- Type
- Error
-
-
-
If
position.length
is negative or will cause the mark to extend past the last character in the document.- Type
- Error
-
-
-
If
position
does not contain the propertystartIndex
orlength
.- Type
- Error
-
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setReason(value) → {PCCViewer.Mark}
Sets the reason in the Redaction Mark.
This method is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
Example
if (mark.setReason) {
mark.setReason("Information for top security clearance only.");
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Redaction reason of the Mark. Acceptable values are any string. |
Throws:
-
If the ViewerControlOptions.
enableMultipleRedactionReasons
property was set totrue
when initializingViewerControl
. In such case you should use the PCCViewer.Mark#setReasons instead.- Type
- Error
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setReasons(value) → {PCCViewer.Mark}
Sets the reasons in the Redaction Mark.
This method is defined on marks of type: RectangleRedaction
, TextSelectionRedaction
.
Example
if (mark.setReasons) {
mark.setReasons(["1.a", "2.b", "Private Information"]);
}
Parameters:
Name | Type | Description |
---|---|---|
value |
Array.<string> |
Redaction reasons of the Mark. Acceptable values are an array of any string. |
Throws:
-
If the ViewerControlOptions.
enableMultipleRedactionReasons
property was set tofalse
when initializingViewerControl
. In such case you should use the PCCViewer.Mark#setReason instead.- Type
- Error
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setRectangle(value) → {PCCViewer.Mark}
Sets the bounding rectangle of the Mark.
This method is defined on marks of type: RectangleAnnotation
, EllipseAnnotation
, TextAnnotation
, StampAnnotation
, RectangleRedaction
, TransparentRectangleRedaction
, TextRedaction
, StampRedaction
, FreehandAnnotation
, FreehandSignature
, TextSignature
, ImageStampAnnotation
, ImageStampRedaction
, TextInputSignature
and TextAreaSignature
.
Example
if (mark.setRectangle) {
mark.setRectangle({x:0, y:0, width:100, height:100});
}
Parameters:
Name | Type | Description |
---|---|---|
value |
Object |
Bounding rectangle of a Mark. The parameter object must be of the following type: |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setSessionData(key, value) → {PCCViewer.Mark}
Sets the session data value for the given key. Unlike PCCViewer.Mark#setData, this data is not saved with the annotation, it only lasts for the session.
This method is defined on all Mark objects.
Example
var mark = viewerControl.addMark(1, "RectangleRedaction");
// 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
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.
|
- See:
Returns:
The Mark object on which the method was called.
- Type
- PCCViewer.Mark
setSignature(signature) → {PCCViewer.Mark}
Note: This property is defined on the template mark of the PlaceSignature
mouse tool, and is not available on any mark.
Sets the signature data to use by the PlaceSignature
mouse tool.
Example
// get the mouse tool
var accusoftPlaceSignature = PCCViewer.MouseTools.getMouseTool('AccusoftPlaceSignature');
// get the template mark
var signatureTemplateMark = accusoftPlaceSignature.getTemplateMark();
// set signature path for freehand signature
signatureTemplateMark.setSignature({path: "M0,0L100,0L100,100L0,100L0,0"});
// the same template can be reused for text signature
signatureTemplateMark.setSignature({ text: "Joe Smith", fontName: "Arial" });
Parameters:
Name | Type | Description |
---|---|---|
signature |
Object | undefined |
An object with properties that specify the signature data. Using See PCCViewer.Signatures~FreehandSignature and PCCViewer.Signatures~TextSignature |
Throws:
-
-
If
signature
is not an Object orundefined
.- Type
- Error
-
-
-
If the signature object does not have either a
path
ortext
string property.- Type
- Error
-
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setStartPoint(value) → {PCCViewer.Mark}
Sets the start point coordinate of the line Mark.
This method is defined on marks of type: LineAnnotation
.
Example
if (mark.setStartPoint) {
mark.setStartPoint({x:1, y:1});
}
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} |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setText(value) → {PCCViewer.Mark}
Sets the text in the Text Mark.
This method is defined on marks of type: TextAnnotation
, TextRedaction
, TextSignature
, TextInputSignature
and TextAreaSignature
.
Note: This method is NOT available for marks of type:HighlightAnnotation
, TextSelectionRedaction
, TextHyperlinkAnnotation
and StrikethroughAnnotation
Example
if (mark.setText) {
mark.setText("This is test Text");
}
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Text of the Mark. Acceptable values are any string. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setThickness(value) → {PCCViewer.Mark}
Sets the thickness of line.
This method is defined on marks of type: LineAnnotation
, FreehandAnnotation
, FreehandSignature
, PolylineAnnotation
, StrikethroughAnnotation
.
Example
if (mark.setThickness) {
mark.setThickness(3);
}
Parameters:
Name | Type | Description |
---|---|---|
value |
number |
Thickness of the line. |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
setVisible() → {PCCViewer.Mark}
Sets the Mark to either visible or invisible depending on the boolean parameter.
This method is defined on all mark types.
Example
if (mark.setVisible) {
mark.setVisible(true); // sets the mark visible
}
Parameters:
Name | Type | Description |
---|---|---|
value. |
boolean |
Returns:
The Mark object on which this method was called.
- Type
- PCCViewer.Mark
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 PCCViewer.Mark#getImage, PCCViewer.Mark#setImage, and PCCViewer.Mark#image members.
Type:
- Object
Properties:
Name | 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. |