(protected) new PrintRequest()
The PrintRequest
object is created when printing the document. This constructor should not be used directly. Instead, a print request is created by PCCViewer.ViewerControl#print, and it is also made available through the PCCViewer.EventType.PrintRequested event.
Example
// A PrintRequest object is created by and returned from the call to the print method
var printRequest = viewerControl.print();
Members
(static, readonly) EventType :string
A list of events that can be triggered by the PCCViewer.PrintRequest object.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
PrintPagePrepared |
string |
Event triggered when a page has been prepared. This event is used to indicate print progress. Augmented properties of the PCCViewer.Event object for this event:
|
PrintCompleted |
string |
Event triggered when print has completed, either due to a success, failure, or a cancel. This event does not indicate whether a user successfully printed the document, as they can still cancel the browser dialog, but rather that all pages were prepared successfully in the print request. Augmented properties of the PCCViewer.Event object for this event:
|
PrintCancelled |
string |
Event triggered if printing is cancelled during the preparation process. Augmented properties of the PCCViewer.Event object for this event:
|
PrintFailed |
string |
Event triggered if the printing process failed due to an error. Augmented properties of the PCCViewer.Event object for this event:
|
(readonly) options :object
Gets a copy of the validated options object which is used by the print request.
The original options object may have been provided to the method PCCViewer.ViewerControl#print. If no options object was provided to print
, or the options object did not define all properties, then the returned object will represent the actual options used.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5.
Type:
- object
(readonly) pageCount :number
This property gets the number of pages which were requested in the print request.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5.
Type:
- number
(readonly) preparedCount :number
This property gets the number of pages which have currently been prepared.
This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5.
Type:
- number
Methods
cancel()
Cancels the print request. This immediately stops the print progress, and no pages will be printed.
getOptions() → {object}
Gets a copy of the validated options object which is used by the print request.
The original options object may have been provided to the method PCCViewer.ViewerControl#print. If no options object was provided to print
, or the options object did not define all properties, then the returned object will represent the actual options used.
Returns:
A copy of the print options object which is used by this print request.
range
{string} A comma-separated string with all page numbers for the requested pages.orientation
{string} The requested print orientation.includeMarks
{boolean} Whether to print the document annotations.margins
{string} Indicated whetherdefault
ornone
margins were used. See PCCViewer.ViewerControl#print.
- Type
- object
getPageCount() → {number}
Gets the number of pages which were requested in the print request.
Returns:
The number of pages which were requested to print.
- Type
- number
getPreparedCount() → {number}
Gets the number of pages which have currently been prepared.
Returns:
The number of pages which have been prepared.
- Type
- number
off() → {PCCViewer.PrintRequest}
Remove event listeners from the PrintRequest
object.
- See:
-
- PCCViewer.ViewerControl#off for more on how it is used.
- PCCViewer.PrintRequest.EventType for a list of events.
Returns:
The object on which this method was called.
on() → {PCCViewer.PrintRequest}
Add event listeners to the PrintRequest
object.
- See:
-
- PCCViewer.PrintRequest.EventType for a list of events.
- PCCViewer.ViewerControl#on for more detailed examples.
Returns:
The object on which this method was called.
Example
var printRequest = viewerControl.print();
printRequest
.on(PCCViewer.PrintRequest.EventType.PrintCompleted,
function(ev) {
alert("Print completed.");
})
.on(PCCViewer.PrintRequest.EventType.PrintPagePrepared,
function(ev) {
alert("Print progress: " + 100 * (ev.index + 1) / ev.totalPages + "%");
});