(protected) new BurnRequest()
The BurnRequest
object is created when burning redactions/signatures in a document.
The BurnRequest
is a thenable object, which allows Promise-like interactions. Calling the PCCViewer.BurnRequest#then method will return a PCCViewer.Promise object. On successful burn, the Promise
success method, if added, is called with url to download the burned document. On a burn failure, the Promise
is rejected.
The BurnRequest
object also provides an event subscription method, to get notified of other types of information. See PCCViewer.BurnRequest.EventType.
Note: This constructor should not be used directly. Instead, a burn request is created by a call to PCCViewer.ViewerControl#burnMarkup.
Example
function onSuccessfulBurn(burnturl) {
alert("burntURL = " + burnturl);
console.log(burnturl);
}
function onFailedBurn(error) {
alert("burn Process failed, reason:" + (error.message ? error.message : error));
}
// A BurnRequest object is created by and returned from the call to the burnMarkup method
var burnRequest = viewerControl.burnMarkup();
burnRequest.then(onSuccessfulBurn, onFailedBurn);
//register some events
burnRequest
.on(PCCViewer.BurnRequest.EventType.BurnCompleted,
function(ev) {
alert("Document burn completed.");
})
.on(PCCViewer.BurnRequest.EventType.BurnProgress,
function(event) {
alert("Burn progress: " + event.percent + "%");
})
.on(PCCViewer.BurnRequest.EventType.BurnFailed,
function(event) {
alert("Document burn failed.");
});
Members
(static) EventType :string
A list of events that can be triggered by the PCCViewer.BurnRequest object.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
BurnProgress |
string |
Triggered when the burn process receives an update. Augmented properties of the PCCViewer.Event object for this event:
|
BurnCompleted |
string |
Triggered when the burn process completes successfully, fails to complete, or is cancelled. Augmented properties of the PCCViewer.Event object for this event: None |
BurnFailed |
string |
Triggered when the burn process fails. Augmented properties of the PCCViewer.Event object for this event: None |
BurnCancelled |
string |
Triggered when user cancels burn process. Augmented properties of the PCCViewer.Event object for this event: None |
BurnWorkerCreated |
string |
Triggered when the burn process is created by the backend burn service. Augmented properties of the PCCViewer.Event object for this event: None |
(readonly) burnedDocumentDownloadURL :string|null
Gets the URL for downloading the burned document after successful burn.
This property is defined on all BurnRequest 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 | null
Example
var downloadUrl = burnRequest.burnedDocumentDownloadURL;
(readonly) errorCode :number
Gets the errorCode if there is a failure during burn process.
This property is defined on all BurnRequest 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
Example
var errorCode = burnRequest.errorCode;
(readonly) options :Object
Gets the options that were provided/used to burn the document.
This property is defined on all BurnRequest 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
Example
var options = burnRequest.options;
(readonly) progress :number
Gets the current estimate of the burn process progress.
This property is defined on all BurnRequest 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
Example
var percentProgress = burnRequest.progress;
(readonly) workerID :number
Gets the worker ID.
This property is defined on all BurnRequest 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
Example
var percentProgress = burnRequest.workerID;
Methods
cancel() → {PCCViewer.BurnRequest}
Cancels the burn request. The PCCViewer.Promise
object that is returned will be rejected. If the user cancels the operation, then a PCCViewer.Error
object will be returned as the rejection reason and its code property will be set to UserCancelled.
Returns:
The cancelled request.
Example
var burnRequest = viewerControl.burnMarkup();
burnRequest.cancel();
getBurnedDocumentDownloadURL() → {string|null}
Gets a URL for a web tier service to download the burned document.
Returns:
Returns a URL to download the burned document. If called before the process completes, or after the process fails, it will return null
.
- Type
- string | null
Example
var burnRequest = viewerControl.burnMarkup();
var geturnedUrl = burnRequest.getBurnedDocumentDownloadURL();
getErrorCode() → {string}
Gets the error code for the burn request, in cases where the request has failed.
Returns:
A value for programmatic identification of an error condition, or null if an error has not occurred. If the error was in the underlying PCCIS MarkupBurner, the error code is the PCCIS error code:
DocumentFileIdError
DocumentFileIdDoesNotExist
MarkupFileIdError
MarkupFileIdDoesNotExist
User Cancelled
Failure to generate Markup XML
- Type
- string
Example
var burnRequest = viewerControl.burnMarkup();
var errorCode = burnRequest.getErrorCode();
getOptions() → {Object}
Gets a copy of the options object used by the burn request.
The original options object has been provided to the method PCCViewer.ViewerControl#burnMarkup. If no options object was provided to burnMarkup
, or the options object did not define all properties, then the returned object will represent the actual options used.
Returns:
A copy of the burn options object which is used by this burn request.
burnSignatures
{boolean} - Whether to burn the signatures.burnRedactions
{boolean} - Whether to burn the redactions.filename
{string} - (optional) Filename for the burned document.
- Type
- Object
Example
var burnRequest = viewerControl.burnMarkup();
var options = burnRequest.getOptions();
getProgress() → {number}
Gets the currently known burn progress value.
Returns:
A number between 0 and 100 (inclusive). A value of 100 means the burn process completed.
Note: In the 9.1 release, the values provided are 0 or 100. The value 0 indicates that the burn process is incomplete.
- Type
- number
Example
var burnRequest = viewerControl.burnMarkup();
var percent = burnRequest.getProgress();
getWorkerID() → {string|null}
Gets the ID of the PCCIS MarkupBurner performing burning.
Returns:
The ID of the PCCIS MarkupBurner performing burning. Returns null
before the worker is created.
- Type
- string | null
Example
var burnRequest = viewerControl.burnMarkup();
var workerId = burnRequest.getWorkerID();
off() → {PCCViewer.BurnRequest}
Remove event listeners from the BurnRequest
object.
- See:
-
- PCCViewer.ViewerControl#off for more on how it is used.
- PCCViewer.BurnRequest.EventType for a list of events.
Returns:
The object on which this method was called.
on() → {PCCViewer.BurnRequest}
Add event listeners to the BurnRequest
object.
- See:
-
- PCCViewer.BurnRequest.EventType for a list of events.
- PCCViewer.ViewerControl#on for more detailed examples.
Returns:
The object on which this method was called.
Example
var burnRequest = viewerControl.burnMarkup();
burnRequest
.on(PCCViewer.BurnRequest.EventType.BurnCompleted,
function(ev) {
alert("Document burn completed.");
})
.on(PCCViewer.BurnRequest.EventType.BurnProgress,
function(event) {
alert("Burn progress: event.percent + "%");
});
then(onFulfilledopt, onRejectedopt) → {PCCViewer.Promise}
Register callbacks to access the current or eventual result of the BurnRequest.
On successful burn, the onFulfilled callback(s) are called with the URL to download the burned document.
On a burn failure, the onRejected callback(s) are called with a PCCViewer.Error.
Multiple onFulfilled or onRejected callbacks can be registered for the same BurnRequest by calling this method multiple times.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onFulfilled |
PCCViewer.Promise~onFulfilled | <optional> |
Called if or when the promise is resolved. Optionally pass a value of |
onRejected |
PCCViewer.Promise~onRejected | <optional> |
Called if or when the promise is rejected. |
Returns:
A promise object that is resolved according to the Promises/A+ standard.
- Type
- PCCViewer.Promise
Example
var viewerControl = $("#myElement").pccViewer(...).viewerControl;
// a basic example
viewerControl.burnMarkup().then(
function onFulfilled(url) {
// download document using `url`
},
function onRejected(error) {
// Handle failure
}
);