(protected) new PiiDetectionRequest()
The PiiDetectionRequest
object is created when detecting PII in a document. It triggers events to indicate PII detection progress and it has properties to get the PII entities and status.
This constructor should not be used directly. Instead, a PII detection request is created by PCCViewer.ViewerControl#detectPii.
Example
// A PiiDetectionRequest object is created by and returned from the call to the detectPii method
var piiDetectionRequest = viewerControl.detectPii();
Members
(readonly) errorCode :number
Gets the error code if there was an error. If there was no error, null
will be returned.
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.
Type:
- number
(readonly) errorMessage :string
Returns a plain text, human-readable, fixed-local message that explains the error condition. If there was no error, null
will be returned.
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.
Type:
- string
(readonly) pagesWithoutText :Array.<number>
Returns an array of page numbers that could not be analyzed for PII because searchable text was not available for the page.
The set of pages without searchable text may still contain text embedded in a rasterized image, but the viewer is unable to detect or search this text. Therefore it is useful to notify the end user when some pages could not be searched.
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.
Type:
- Array.<number>
(readonly) piiEntities :Array.<PCCViewer.PiiEntity>
Gets an array of all PII entities produced by this PiiDetectionRequest
up until this point.
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.
Type:
- Array.<PCCViewer.PiiEntity>
Methods
getErrorCode() → {number}
Returns the error code if there was an error. If there was no error, null
will be returned.
Example
var errorCode = piiDetectionRequest.getErrorCode();
Returns:
An error code indicating the type of error, or null.
The possible error codes are:
1010
- An unexpected exception occurred.1011
- There was a failure retrieving data from the server.ServerSearchUnavailable
- Server-side search is not available.
- Type
- number
getErrorMessage() → {string}
Returns a plain text, human-readable, fixed-local message that explains the error condition. If there was no error, null
will be returned.
Example
var errorMessage = piiDetectionRequest.getErrorMessage();
Returns:
A plain text error message that explains the error condition, or null.
- Type
- string
getPagesWithoutText() → {Array.<number>}
Returns an array of page numbers that could not be analyzed for PII because searchable text was not available for the page.
The set of pages without searchable text may still contain text embedded in a rasterized image, but the viewer is unable to detect or search this text. Therefore it is useful to notify the end user when some pages could not be searched.
Example
// Use pagesWithoutText to alert the end user that some pages could not be searched.
var pagesWithoutText = piiDetectionRequest.getPagesWithoutText();
Returns:
Returns an array of page numbers, or an empty array if all pages had searchable text.
- Type
- Array.<number>
getPiiEntities() → {Array.<PCCViewer.PiiEntity>}
Returns an array of all PII entities produced by this PiiDetectionRequest
up until this point.
Example
var piiEntities = piiDetectionRequest.getPiiEntities();
Returns:
An array of PiiEntity
objects. If no piiEntities are found, this will be an empty array.
- Type
- Array.<PCCViewer.PiiEntity>
off(eventType, handler) → {PCCViewer.PiiDetectionRequest}
Unsubscribe a handler from an event of the PiiDetectionRequest
.
Typically, event is unsubscribed when you no longer want further notification of the event.
Example
// subscribe
piiDetectionRequest.on(PCCViewer.EventType.PiiDetectionCompleted, onPiiDetectionCompleted);
// unsubscribe
piiDetectionRequest.off(PCCViewer.EventType.PiiDetectionCompleted, onPiiDetectionCompleted);
// handler declaration
function onPiiDetectionCompleted(ev) {
alert("PII detection completed! Number of PII entities:" + piiDetectionRequest.getPiiEntities().length);
}
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string |
A string specifying the event type. See PCCViewer.PiiDetectionRequest#on for possible values. |
handler |
function |
The function that was previously subscribed to the event type. |
Returns:
The PiiDetectionRequest
object on which this method was called.
on(eventType, handler) → {PCCViewer.PiiDetectionRequest}
Subscribe a handler to an event of the PiiDetectionRequest
.
Example
// subscribe
piiDetectionRequest.on(PCCViewer.EventType.PiiDetectionCompleted, onPiiDetectionCompleted);
// handler declaration
function onPiiDetectionCompleted(ev) {
alert("PII detection completed! Number of PII entities:" + piiDetectionRequest.getPiiEntities().length);
}
Parameters:
Name | Type | Description |
---|---|---|
eventType |
string |
A string that specifies the event type.
|
handler |
function |
The function that will be called whenever the event is triggered. |
Returns:
The PiiDetectionRequest
object on which this method was called.