-
new ViewerControl(element, options)
-
Creates a new
PCCViewer.ViewerControlobject.Parameters:
Name Type Description elementHTMLDivElement Embed the ViewerControl in this element.
optionsPCCViewer.ViewerControl~ViewerControlOptions Specify options for the ViewerControl object. Some options are required.
Members
-
<readonly> atMaxScale :boolean
-
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.
It checks whether the viewer is currently at the maximum zoom level.
Type:
- boolean
-
<readonly> atMinScale :boolean
-
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.
It checks whether the viewer is currently at the minimum zoom level.
Type:
- boolean
-
currentMouseTool :string
-
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.
Gets and sets the current mouse tool of the viewer by name.
Type:
- string
-
<readonly> isCommentsPanelOpen :boolean
-
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.
Gets a value indicating whether the comments panel is open.
Type:
- boolean
-
<readonly> pageCount :number
-
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.
Gets the document page count.
Type:
- number
-
pageNumber :number
-
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.
Gets and sets the current page of the viewer to the specified page number in the document. Setting the page number to a value other than the current page number will cause the viewer to navigate to the page number provided in the parameter.
Type:
- number
-
<readonly> searchRequest :PCCViewer.SearchRequest
-
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.
Gets the
SearchRequestobject from the last call to PCCViewer.ViewerControl#search.Type:
-
selectedConversation :PCCViewer.Conversation
-
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.
Gets and sets the selected conversation.
Type:
-
<readonly> selectedMarks :Array.<PCCViewer.Mark>
-
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.
Gets an array of selected marks.
Type:
- Array.<PCCViewer.Mark>
-
selectedSearchResult :PCCViewer.SearchResult|null
-
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.
Gets and sets the selected
SearchResultobject. Returns null if no search results are selected. Note: Setting the search result through this property will always scroll to it.Type:
- PCCViewer.SearchResult | null
-
viewMode :PCCViewer.ViewMode
-
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.
Gets or sets the view mode. This defines how the document pages will be scaled, based on the values of the PCCViewer.ViewMode enumerable values.
Type:
-
<inner> TextSelection
-
A plain object convention describing a text selection.
-
Properties:
-
Name Type Description pageNumbernumber The page number that the selection starts on.
lengthnumber The length of the text.
textstring The selected text. This is plain text without any formatting.
startIndexnumber The index at which the selection starts in the page.
-
-
Methods
-
addMark(pageNumber, markType) → {PCCViewer.Mark}
-
Creates a new mark of a specific type and adds to the specified page.
Parameters:
Name Type Description pageNumbernumber Indicates the page to which to add the mark.
markTypePCCViewer.Mark.Type | string Indicates the type of mark being added
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If an invalid
pageNumberis provided. -
- Type
- Error
-
Returns:
The new mark.
- Type
- PCCViewer.Mark
Example
viewerControl.addMark(1, "LineAnnotation"); -
-
burnMarkup(options) → {PCCViewer.BurnRequest}
-
Burns redactions and signatures in the document.
Parameters:
Name Type Argument Description optionsObject <optional> This optional parameter specifies burn options to be used for burning the document. The PCCViewer.ViewerControl~BurnOptions details the options object.
Properties
Name Type Argument Default Description burnSignaturesboolean <optional> true Indicates whether signatures are required to be burned.
burnRedactionboolean <optional> true Indicates whether redactions are required to be burned.
filenamestring <optional> Sets the value of the Content-Disposition filename in the header of the response from the URL to download the document. If not set, then the burned document will be downloaded with a default filename.
- See:
-
- PCCViewer.BurnRequest for more details on interacting with the burn process.
Returns:
A result
BurnRequestfor this task.Example
function onSuccessfulBurn(burnturl) { alert("burntURL = " + burnturl); console.log(burnturl); } function onFailedBurn(reason) { alert("burn Process failed, error:" + reason); } // 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."); }); // Also, methods on the burnRequest object can be used // get the options used to burn the document. var optionsUsed = burnRequest.getOptions(); //if the process is still incomplete, cancel can be used to stop queries to the server. if(burnRequest.getProgress() >= 0 && burnRequest.getProgress() < 100) { burnRequest.cancel(); } -
canPrintMarks() → {boolean}
-
Informs whether the current browser is capable of printing the annotations and redactions on a document. If
true, the document can be printed with annotations and redactions. Iffalse, the document will be printed without annotations, regardless of the print request made.Returns:
A value indicating whether the browser is capable of printing annotations and redactions on a document.
- Type
- boolean
Example
var printWithMarks = true; viewerControl.print({ includeMarks: (printWithMarks && viewerControl.canPrintMarks()) }); -
changeToFirstPage() → {PCCViewer.ViewerControl}
-
Sets the current page of the viewer to the first page of the document.
Note: Does nothing if the current page is the first page of the document.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.changeToFirstPage(); -
changeToLastPage() → {PCCViewer.ViewerControl}
-
Sets the current page of the viewer to the last known page of the document.
Note: Does nothing if the current page is the last known page of the document.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.changeToLastPage(); -
changeToNextPage() → {PCCViewer.ViewerControl}
-
Sets the current page of the viewer to the next page of the document.
Note: Does nothing if the current page is the last known page of the document.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.changeToNextPage(); -
changeToPrevPage() → {PCCViewer.ViewerControl}
-
Sets the current page of the viewer to the previous page of the document.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.changeToPrevPage(); -
clearMouseSelectedText(textSelection) → {PCCViewer.ViewerControl}
-
Deselects the text provided in a
TextSelectedevent.Parameters:
Name Type Description textSelectionPCCViewer.ViewerControl~TextSelection The
textSelectionobject provided in theTextSelectedevent arguments.Throws:
-
-
If
textSelectionis undefined. -
- Type
- Error
-
-
-
If
textSelection.pageNumberis not a known page number. -
- Type
- Error
-
-
-
If
textSelection.startIndexis not a number or is negative. -
- Type
- Error
-
-
-
If
textSelection.lengthis not a number or is less than 1. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
var onTextSelected = function(ev){ var mark = viewerControl.addMark(ev.textSelection.pageNumber, 'HighlightAnnotation'); mark.setPosition(ev.textSelection); // clear the highlighted text ViewerControl.clearMouseSelectedText(ev.textSelection); }; viewerControl.on('TextSelected', onTextSelected); -
-
clearSearch() → {PCCViewer.ViewerControl}
-
Clears the search hit highlights and removes the
SearchRequestfrom theViewerControl.After calling this, PCCViewer.ViewerControl#getSearchRequest will not return the last
SearchRequest.Throws:
-
If the PCCViewer.EventType.ViewerReady event has not fired prior to using this method.
-
- Type
- Error
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.search("Foo"); // As search results become available, they are highlighted on the document. // Clear search result highlights from the document. viewerControl.clearSearch(); -
-
clearSelectedSearchResult() → {PCCViewer.ViewerControl}
-
This methods clears the search result selection, or in other words, it deselects the search result. If there is not a selected search result when this method is called, then the method has no effect.
This method is offered as a convenience to API callers, who could also call PCCViewer.ViewerControl#setSelectedSearchResult(null).
Throws:
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
The
ViewerControlobject on which this method was called.Example
var searchRequest = viewerControl.search('Accusoft'); // add events to the search request searchRequest.on("SearchCompleted", function(){ // get the search results results = searchRequest.getResults(); // set the result to the first viewerControl.setSelectedSearchResult(results[0], true); // clear the selected search result viewerControl.clearSelectedSearchResult(); }); -
-
closeCommentsPanel() → {PCCViewer.ViewerControl}
-
Closes the comments panel.
Throws:
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.closeCommentsPanel(); -
-
convertToHighlight(searchResult) → {PCCViewer.Mark}
-
Converts a search result into a highlight annotation.
Parameters:
Name Type Description searchResultPCCViewer.SearchResult The search result to convert to a highlight.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the provided parameter is not a valid PCCViewer.SearchResult object created in the current session.
-
- Type
- Error
-
Returns:
The new PCCViewer.Mark.
- Type
- PCCViewer.Mark
Example
var searchRequest = viewer.search("Hello"); var searchResult = searchRequest.getResults(); for (var i = 0; i < searchResult.length; i++) { var mark = viewer.convertToHighlight(searchResult[i]); } -
-
convertToRedaction(searchResult) → {PCCViewer.Mark}
-
Converts a search result into a text selection redaction.
Parameters:
Name Type Description searchResultPCCViewer.SearchResult The search result to convert to a redaction.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the provided parameter is not a valid PCCViewer.SearchResult object created in the current session.
-
- Type
- Error
-
Returns:
The new PCCViewer.Mark.
- Type
- PCCViewer.Mark
Example
var searchRequest = viewer.search("Hello"); var searchResult = searchRequest.getResults(); for (var i = 0; i < searchResult.length; i++) { var mark = viewer.convertToRedaction(searchResult[i]); } -
-
deleteAllMarks() → {PCCViewer.ViewerControl}
-
Deletes all marks in all the pages of the document.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.deleteAllMarks(); -
deleteMarks(marks) → {PCCViewer.ViewerControl}
-
Deletes the specified marks.
Parameters:
Name Type Description marksArray.<PCCViewer.Mark> An Array of objects of type PCCViewer.Mark.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If any of the marks passed in are not valid objects of the type PCCViewer.Mark.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.deleteMarks(viewer.getSelectedMarks()); -
-
deselectAllMarks() → {PCCViewer.ViewerControl}
-
Deselects all previously selected marks.
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.deselectAllMarks(); -
deselectMarks(marks) → {PCCViewer.ViewerControl}
-
Deselects the marks provided in the parameter array object.
Parameters:
Name Type Description marksArray.<PCCViewer.Mark> An array of PCCViewer.Mark objects that exist in the document and need to be deselected.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to calling this method.
-
- Type
- Error
-
-
-
If any of the mark objects are not valid PCCViewer.Mark objects, the id of the mark provided does not match the id of mark loaded in the viewer, or the mark provided was not previously added to the document pages.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// deselect all marks with an odd-number ID viewerControl.getSelectedMarks().forEach(function(mark){ var arr = []; if (+mark.getId() % 2) arr.push(mark); viewerControl.deselectMarks(arr); }); -
-
destroy()
-
Closes and cleans up the viewer control. After this action, a new viewer can be created in its place.
Example
viewerControl.destroy(); -
documentHasText() → {PCCViewer.Promise}
-
Indicates whether or not any pages in the document have text. This method returns a promise, which can resolve at an indefinite time. This promise will resolve at the first instance of finding text in the document, but will not actively search for text if none is yet found. Unless this promise has resolved, the user should assume that the document does not contain text.
For example, in a 100 page document, where only page 80 has text, this promise will not resolve until the user views page 80. If the document were to have no text at all, the promise will not resolve until all 100 pages were viewed by the user.
The successful callback be passed only a boolean indicating whether the document has any text or not.
Returns:
a
Promiseobject.- Type
- PCCViewer.Promise
Example
var promise = viewerControl.documentHasText().then( function success(containsTextBool){ alert('Documenthas text: ' + (containsTextBool ? 'Yes' : 'No')); } ); -
fitContent(fitType) → {PCCViewer.ViewerControl}
-
Changes the scaling (zoom) of the document to fit the content in the viewer. How the content is fit in the viewer is based on the specified by the values in the PCCViewer.FitType enumerable.
Parameters:
Name Type Description fitTypestring Specifies how the content will be scaled to fit in the viewer.
- See:
-
- PCCViewer.FitType for a list of possible FitType values and their descriptions.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
It the value of
fitTypeis unknown. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// Explicitly specify the fit type viewerControl.fitContent("FullWidth"); // or use the enumeration viewerControl.fitContent(PCCViewer.FitType.FullWidth); -
getAllMarks() → {Array.<PCCViewer.Mark>}
-
Gets all marks.
Returns:
An array of PCCViewer.Mark objects. Note: Returns an empty array if the viewer has not been initialized.
- Type
- Array.<PCCViewer.Mark>
Example
var allMarks = viewer.getAllMarks(); -
getAtMaxScale() → {boolean}
-
Gets a value that indicates whether the viewer is currently at the maximum scale factor. As long as this value is
true, theViewerControldo nothing if asked to zoom in any further.This method determines the value each time, and will be affected by the following:
- The viewer scale changes due to
zoomIn,zoomOut, orfitContent. - The window resizes.
- The div that holds the viewer control is resized.
Throws:
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
A value that indicates whether the viewer is currently at maximum zoom.
- Type
- boolean
Examples
// Check for change after the viewer scale changes viewerControl.on(PCCViewer.EventType.ScaleChanged, function(ev){ var atMax = viewer.getAtMaxScale(); }// Check for change when the window resizes (using jQuery) $(window).resize(function() { var atMax = viewer.getAtMaxScale(); }); - The viewer scale changes due to
-
getAtMinScale() → {boolean}
-
Gets a value that indicates whether the viewer is currently at the minimum scale factor. As long as this value is
true, theViewerControldo nothing if asked to zoom out any further.This method determines the value each time, and will be affected by the following:
- The viewer scale changes due to
zoomIn,zoomOut, orfitContent. - The window resizes.
- The div that holds the viewer control is resized.
Throws:
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
A value that indicates whether the viewer is currently at minimum zoom.
- Type
- boolean
Examples
// Check for change after the viewer scale changes viewerControl.on(PCCViewer.EventType.ScaleChanged, function(ev){ var atMax = viewer.getAtMinScale(); }// Check for change when the window resizes (using jQuery) $(window).resize(function() { var atMax = viewer.getAtMinScale(); }); - The viewer scale changes due to
-
getCharacterIndex(sortableObject) → {Number}
-
Returns the index of the character at the location of the specified object. If there is no character at the location, the index of the character before the location (based on the closest line of text) is returned.
Parameters:
Name Type Description sortableObjectPCCViewer.Mark | PCCViewer.SearchResult | Object A mark or search result in a page, or an object containing pageNumber, x, and y values.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If sortableObject is not a valid PCCViewer.Mark or PCCViewer.SearchResult, or if it is not an Object with valid pageNumber, x, and y values. When specifying a pageNumber greater than 1, this method requires that the PageCountReady event has been triggered, otherwise an error is thrown.
-
- Type
- Error
-
Returns:
The text index at or before the position of the specified object.
- Type
- Number
Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // get the sort index if (theFirstMark) var firstMarkSortIndex = viewerControl.getCharacterIndex(theFirstMark); -
-
getConversationDOMFactory() → {function}
-
Gets the conversation DOM factory function. The default factory function is returned if a factory function has not been set using the PCCViewer.ViewerControl#setConversationDOMFactory method.
Returns:
The function for creating a conversation DOM element.
- Type
- function
-
getCurrentMouseTool() → {string}
-
Gets the current mouse tool of the viewer.
Returns:
A value indicating the name of the current mouse tool.
- Type
- string
Example
// get the current mouse tool name var mouseToolName = viewerControl.getCurrentMouseTool(); // get the actual MouseTool object var mouseToolObject = PCCViewer.MouseTools.getMouseTool(mouseToolName); -
getDownloadDocumentURL() → {string}
-
Gets the URL to download the original document.
- See:
-
- The help section titled "Digital Rights Management Configuration" for information on disabling document download.
Returns:
The URL for downloading the original document. This URL is relative to current page.
- Type
- string
Example
// get the URL var documentURL = viewerControl.downloadDocument(); // download the document window.location.href = documentURL; -
getIsCommentsPanelOpen() → {boolean}
-
Returns a value (
trueorfalse) indicating if the comments panel is open.Throws:
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
A value indicating if the comments panel is open.
- Type
- boolean
Example
var isCommentsPanelOpen = viewerControl.getIsCommentsPanelOpen(); // true if comments panel is open -
-
getMarkById(markId) → {PCCViewer.Mark}
-
Gets the specified mark.
Parameters:
Name Type Description markIdnumber The ID of the mark to retrieve.
Returns:
The mark that corresponds to the specified ID.
- Type
- PCCViewer.Mark
Example
var mark = viewer.getMarkById(1); -
getMarksByType(markType) → {Array.<PCCViewer.Mark>}
-
Get marks by type.
Parameters:
Name Type Description markTypePCCViewer.Mark.Type | string The mark type being requested. Note: Returns an empty array if the viewer has not been initialized.
- See:
-
- PCCViewer.Mark.Type for a list of valid mark types.
Throws:
-
If the parameter markType is an invalid mark type.
-
- Type
- Error
Returns:
An array of PCCViewer.Mark objects of the requested type.
- Type
- Array.<PCCViewer.Mark>
Example
var marksByType = viewer.getMarksByType(markType); -
getPageCount() → {number}
-
Gets the known page count of the current document.
This value is updated when the viewer gets the page count or estimated page count from the server. Subscribe to the PCCViewer.EventType.PageCountReady and PCCViewer.EventType.EstimatedPageCountReady events to be notified when the viewer gets the page count from the server.
The initial value is 1, before any page count event.
- See:
-
- PCCViewer.EventType for the event type "PageCountReady".
Returns:
The known page count.
- Type
- number
Example
// First, create the pccViewer. var viewerControl = $("#viewer").pccViewer(viewerOptions).viewerControl; function pageCountReadyHandler(event) { // The page count has now been determined. var pageCount = viewer.getPageCount(); alert("Number of pages = " + pageCount); // Now, unsubscribe from the event. viewerControl.off("PageCountReady", pageCountReadyHandler); } // Subscribe to the PageCountReady event exposed by the API viewerControl.on("PageCountReady", pageCountReadyHandler); -
getPageLayout() → {PCCViewer.PageLayout}
-
Gets the page layout. This defines how the document pages will be arranged, based on the values of the PCCViewer.PageLayout enumeration.
- See:
Returns:
A value indicating the page layout.
- Type
- PCCViewer.PageLayout
Example
var pageLayout = viewerControl.getPageLayout(); -
getPageNumber() → {number}
-
Gets the current page number of the viewer. This is a 1-based value, so the first page of a document is 1.
- See:
Returns:
The current page of the viewer.
Note: a value of 1 is returned before page count is available.
- Type
- number
Example
var currentPageNumber = viewerControl.getPageNumber(); -
getPageRotation(pageNumber) → {number}
-
gets the page rotation value for the specified page number.
Parameters:
Name Type Description pageNumbernumber | string This is an optional parameter. A 1-based page number of the page. An optional string representation of a valid number is also accepted as a parameter. If this parameter is not provided, the implied pageNumber will be the currentPage.
Throws:
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the provided optional parameter
pageNumberis less than 1 or greater than the value returned by PCCViewer.ViewerControl#getPageCount. -
- Type
- Error
-
-
-
If the provided optional parameter
pageNumberis not a number or a string representation of a number. -
- Type
- Error
-
-
-
If the provided optional parameter
pageNumberis not an integer page number. -
- Type
- Error
-
Returns:
The rotation amount in degrees clockwise.
- Type
- number
Example
// first create the pccViewer : Note: if the viewer object has already been created, do not re-create it. var viewerControl = $("#viewer").pccViewer(viewerOptions).viewerControl; var pageNumber = 2; var rotationAngle = viewerControl.getPageRotation(pageNumber); -
-
getSavedMarkupNames() → {PCCViewer.Promise}
-
Gets a list of all saved markups from the server for the current document.
The PCCViewer.Promise~onFulfilled function gets passed an
ArrayofObjects. Each object will have anameproperty, which is a string representation of the name used to save the markup.Returns:
A PCCViewer.Promise object.
- Type
- PCCViewer.Promise
Example
viewerControl.getSavedMarkupNames().then( function onSuccess(markupNameObjects) { var namesArray = []; for (var i = 0; i < markupNames.length; i++) { namesArray.push(markupNames[i].name); } alert(namesArray.join(', '); }, function onFailure(reason) { alert(reason); } ); -
getSearchRequest() → {PCCViewer.SearchRequest}
-
Gets the
SearchRequestobject from the last call to PCCViewer.ViewerControl#search.Returns:
The
SearchRequestfrom the last search, ornullif a search has not been performed or if the search has been cleared with PCCViewer.ViewerControl#clearSearch.Example
var searchRequestA = viewerControl.search("Foo"); var searchRequestB = viewerControl.getSearchRequest(); searchRequestA === searchRequestB; // true -
getSelectedConversation() → {PCCViewer.Conversation}
-
Gets the selected conversation.
Returns:
The selected conversation, or
nullif no conversation is currently selected.Example
var selectedConversation = viewerControl.getSelectedConversation(); -
getSelectedMarks() → {Array.<PCCViewer.Mark>}
-
Obtains all the selected marks in the currently loaded document. If none of the marks are selected or if the document does not contain any marks then the returned array will be empty.
Returns:
An array of selected PCCViewer.Mark objects.
- Type
- Array.<PCCViewer.Mark>
Example
var selectedMarks = viewerControl.getSelectedMarks(); if (selectedMarks.length) alert(selectedMarks.length + " marks are currently selected"); else alert("No marks are currently selected"); -
getSelectedSearchResult() → {PCCViewer.SearchResult|null}
-
Gets the selected PCCViewer.SearchResult object.
Returns:
The PCCViewer.SearchResult object. Returns
nullif no search result is selected.- Type
- PCCViewer.SearchResult | null
-
getViewMode() → {PCCViewer.ViewMode}
-
Gets the view mode. This defines how the document pages will be scaled, based on the values of the PCCViewer.ViewMode enumerable values.
- See:
Returns:
A value indicating the view mode.
- Type
- PCCViewer.ViewMode
Example
var viewMode = viewerControl.getViewMode(); -
isPageTextReady(pageNumber) → {boolean}
-
Returns a value indicating if the ViewerControl has loaded text for a page from the server.
Several of the ViewerControl's methods require that the ViewerControl has loaded the text for the page. These methods will not work if the text for the target page(s) is not loaded. This set of methods includes:
The ViewerControl may delay loading of text for a page, so it is not safe to assume that the ViewerControl has text for a page when ViewerReady is triggered. However, if you have gotten page text through the viewer, then it is safe to assume the viewer has text for the page. For example, if you get text through a SearchResult generated by PCCViewer.ViewerControl#search or by calling PCCViewer.ViewerControl#requestPageText, then the viewer will have loaded page text from the server.
Parameters:
Name Type Description pageNumbernumber The method checks if page text is ready for this page number.
- See:
Throws:
-
If the
pageNumberargument is less than 1 or greater than the page count of the document. -
- Type
- Error
Returns:
A value indicating if the ViewerControl has loaded text for a page from the server.
- Type
- boolean
Example
if (!viewerControl.isPageTextReady(1)) { viewerControl.requestPageText(1).then( function(pageText) { highlightSomeText({ startIndex: 0, length: pageText.length }); } ); } else { // Note that it's pretty silly to blindly highlight text, you would almost always want to know // the text tht you are trying to highlight before calling the API to set the position. But, this is just // an example to demonstrate when you don't *have* to request the page text. highlightSomeText({startIndex: 0, length: 5}); } // Note: an alternative to the if-else above, would be to always call requestPageText, which will immediately resolve // if the viewer already has page text. Using this approach, you don't need to call `isPageTextReady`. // viewerControl.requestPageText(1).then( // function(pageText) { // highlightSomeText({ // startIndex: 0, // length: pageText.length // }); // } // ); function highlightSomeText(position) { viewerControl.addMark(1, "HighlightAnnotation") .setPosition(position); } -
loadMarkup(recordName) → {PCCViewer.Promise}
-
Loads the markup with the specified name from the server. This returns a PCCViewer.Promise object.
If the parameter
recordNameis invalid, then thePCCViewer.Promiseobject that is returned will be rejected.Note: any existing marks in the document are removed before marks are loaded.
Parameters:
Name Type Description recordNamestring Name of the annotation record to be loaded.
Returns:
a Promise object.
- Type
- PCCViewer.Promise
Example
viewerControl.loadMarkup("mymarkup").then( function onResolved() { // update the UI, or whatever... because the markup loaded successfully }, function onRejected(reason) { alert("loading failed! " + reason); }); -
moveMarkBackward(mark) → {PCCViewer.ViewerControl}
-
Moves the specified mark one slot backward from its position in the internal
z-order. When the marks overlap, marks that are higher in this internalz-orderare drawn over the marks that are lower.Parameters:
Name Type Description markPCCViewer.Mark The mark being moved.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the mark is an invalid PCCViewer.Mark object or a template mark.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // move it backward if (theFirstMark) viewerControl.moveMarkBackward(theFirstMark); -
-
moveMarkForward(mark) → {PCCViewer.ViewerControl}
-
Moves the specified mark one slot toward the top of the internal
z-order. When the marks overlap, marks that are higher in this internalz-orderare drawn over the marks that are lower.Parameters:
Name Type Description markPCCViewer.Mark The mark being moved.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the mark is an invalid PCCViewer.Mark object or a template mark.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // move it forward if (theFirstMark) viewerControl.moveMarkForward(theFirstMark); -
-
moveMarkToBack(mark) → {PCCViewer.ViewerControl}
-
Moves the specified mark to the back. When the marks overlap, the marks that are higher in the internal
z-orderon a page are drawn over the ones that are lower.Parameters:
Name Type Description markPCCViewer.Mark The mark being moved.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event has not fired prior to calling this method.
-
- Type
- Error
-
-
-
If the mark is an invalid PCCViewer.Mark object or a template mark.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // move it forward if (theFirstMark) viewerControl.moveMarkForward(theFirstMark); -
-
moveMarkToFront(mark) → {PCCViewer.ViewerControl}
-
Moves the specified mark to the front or to the top of internal
z-orderon a page. When the marks overlap, the marks with higher internalz-orderare drawn over the ones that are lower.Parameters:
Name Type Description markPCCViewer.Mark The mark being moved.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the mark is an invalid PCCViewer.Mark object or a template mark.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // move it forward if (theFirstMark) viewerControl.moveMarkForward(theFirstMark); -
-
off(eventType, handler) → {PCCViewer.ViewerControl}
-
Unsubscribe an event handler from a specified event type.
Typically, an event is unsubscribed when you no longer want further notification of the event.
Parameters:
Name Type Description eventTypestring A string specifying the event type. See PCCViewer.EventType for a list and description of all supported events.
handlerPCCViewer.Event~eventHandler A function that was attached previously to the
ViewerControl.Note: This must be the same function object previously passed to PCCViewer.ViewerControl#on. It cannot be an different object that is functionally equivalent.
Returns:
The
ViewerControlobject on which this method was called.Example
// Our event handler declaration function handler(event) { alert("An event was fired: " + event.getType()); } // Subscribe viewerControl .on("PageChanged", handler) .on("PageCountReady", handler); // Un-subscribe viewerControl .off("PageChanged", handler), // Use string literals or the enum. .off(PCCViewer.EventType.PageCountReady, handler); // Chain unsubscription. -
on(eventType, handler) → {PCCViewer.ViewerControl}
-
Subscribe an event handler to an event of a specified type.
Parameters:
Name Type Description eventTypestring A string that specifies the event type. This value is case-insensitive. See PCCViewer.EventType for a list and description of all supported events.
handlerPCCViewer.Event~eventHandler A function that will be called whenever the event is triggered.
Returns:
The
ViewerControlobject on which this method was called.Example
// Create the viewer and get the ViewerControl object. var viewerControl = $("#viewer").pccViewer(viewerOptions}).viewerControl; // Our event handler declaration function handler(event) { alert("An event was fired: " + event.getType()); } viewerControl .on(PCCViewer.EventType.PageChanged, handler) // Use the PCCViewer.EventType enum. .on(PCCViewer.EventType.PageDisplayed, handler) // Chain event subscription. .on("PageLoadFailed", handler); // Use string literals instead of the EventType enum. -
openCommentsPanel() → {PCCViewer.ViewerControl}
-
Opens the comments panel.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the page layout is set to
"Horizontal". -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.openCommentsPanel(); -
-
print(options) → {PCCViewer.PrintRequest}
-
Print the document associated with the PCCViewer.ViewerControl object.
Parameters:
Name Type Argument Description optionsObject <optional> Provides instructions for what to print. The object may have the following properties:
Properties
Name Type Argument Default Description rangestring <optional> "all" A string representing the pages to print. Pages are separated by commas, and ranges are separated by a hyphen.
- Sample value:
"1, 2, 5-7, 9, 15-20" - Sample value:
"all"
orientationstring <optional> "portrait" Describes the orientation of the printed pages.
- Possible values:
"portrait"or"landscape"
includeMarksboolean <optional> false Whether to print annotations.
- Possible values:
trueorfalse - Note: this value will be ignored if PCCViewer.ViewerControl#canPrintMarks returns
false.
marginsstring <optional> "default" Whether to respect the default browser margins. This affects IE and Safari.
- Possible values:
"default"When necessary, the pages will be smaller, so that the entire page content can fit on one printed page."none"Content will always be printed as an 8.5x11 inch page. The user is expected to set the browser print margins to 0.
- See:
-
- Use PCCViewer.ViewerControl#validatePrintRange to validate a user supplied print range before calling `print`.
- Use PCCViewer.ViewerControl#canPrintMarks to determine if the browser support printing annotations and redactions.
Throws:
-
If the page(s) are out of range.
-
- Type
- Error
Returns:
Example
// Prints pages 1 and 3 of the document. // Any annotations on those pages will also be printed if supported by the browser. viewerControl.print({ range : "1, 3", includeMarks : true }); - Sample value:
-
refreshConversations(conversations) → {PCCViewer.ViewerControl}
-
Forces a DOM refresh of a specified conversation or set of conversations, or all conversations known to the
ViewerControl.Parameters:
Name Type Argument Description conversationsPCCViewer.Conversation | Array.<PCCViewer.Conversation> <optional> A single
PCCViewer.Conversationobject, or an Array of conversation objects. If this parameter is leftundefined, all conversations will be refreshed.Throws:
-
-
If the
conversationsparameter is notundefined, aPCCViewer.Conversationobject, or an array of conversation objects. -
- Type
- Error
-
-
-
If any of the
PCCViewer.Conversationobjects in the parameter are not conversations of known marks. -
- Type
- Error
-
-
-
If during the refresh, any call to the DOM Factory does not return a valid
HTMLElementor a false value. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called. -
-
requestPageAttributes() → {PCCViewer.Promise}
-
Requests attributes for the specified page.
If the
pageNumberparameter is invalid at the time the method is called, or the page does not exist in the document, then the returnedPCCViewer.Promiseobject is rejected.The PCCViewer.Promise~onFulfilled function will receive and
Objectwith propertieswidthandheight, representing the reported width and height of each page.Returns:
a
Promiseobject.- Type
- PCCViewer.Promise
Example
var promise = viewerControl.requestPageAttributes(10).then( function(pageAttributes) { alert('Page 10 attributes: width: ' + pageAttributes.width + ', height: ' + pageAttributes.height); }, function(reason) { alert('Page attributes retrieval for page 10 failed: ' + reason); } ); -
requestPageText(pageNumber) → {PCCViewer.Promise}
-
Requests the specified text page.
If the
pageNumberparameter is invalid at the time the method is called, or the page does not exist in the document, then the returnedPCCViewer.Promiseobject is rejected.The PCCViewer.Promise~onFulfilled function will receive and
stringvalue, representing the text found on that page. If the page has no text, this will be an empty string.Parameters:
Name Type Description pageNumbernumber Page text is requested for this page number.
Returns:
a
Promiseobject.- Type
- PCCViewer.Promise
Example
var promise = viewerControl.requestPageText(10).then( function(pageText) { alert('Text from page 10: ' + pageText); }, function(reason) { alert('Text retrieval for page 10 failed: ' + reason); } ); -
rotateDocument(degreesClockwise) → {PCCViewer.ViewerControl}
-
Rotates all pages in the document by the specified degrees clockwise, relative to each page's current orientation.
Parameters:
Name Type Description degreesClockwisenumber Degrees clockwise to rotate each page.
Valid values are multiples of 90: ...,
-270,-180,-90,0,90,180,270, ...Throws:
-
-
If value of
degreesClockwiseis not valid. TheErrorobject will contain propertymessagewith details of the error. -
- Type
- Error
-
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.rotateDocument(90); // Rotates 90 degrees clockwise viewerControl.rotateDocument(-90); // Rotates 90 degrees counter-clockwise viewerControl.rotateDocument(180); // Rotates 180 degrees viewerControl.rotateDocument(540); // Also, rotates 180 degrees viewerControl.rotateDocument(100); // Throws! -
-
rotatePage(degreesClockwise) → {PCCViewer.ViewerControl}
-
Rotates the current page by the specified degrees clockwise, relative to the page's current orientation.
Parameters:
Name Type Description degreesClockwisenumber Degrees clockwise to rotate the page.
Valid values are multiples of 90: ...,
-270,-180,-90,0,90,180,270, ...Throws:
-
-
If value of
degreesClockwiseis not valid. TheErrorobject will contain propertymessagewith details of the error. -
- Type
- Error
-
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.rotatePage(90); // Rotates 90 degrees clockwise viewerControl.rotatePage(-90); // Rotates 90 degrees counter-clockwise viewerControl.rotatePage(180); // Rotates 180 degrees viewerControl.rotatePage(540); // Also, rotates 180 degrees viewerControl.rotatePage(100); // Throws! -
-
saveMarkup(recordName, options) → {PCCViewer.Promise}
-
Saves all markups in the document to the server as a record with a specified name.
If the parameter
recordNameis invalid, then thePCCViewer.Promiseobject that is returned will be rejected.The PCCViewer.Promise~onFulfilled function will receive the
recordNamestring as its only argument.Note: this method will overwrite any previous markup stored with the same name. To prevent duplicates, check to see if the name already exists by using PCCViewer.ViewerControl#getSavedMarkupNames.
Parameters:
Name Type Argument Description recordNamestring Name of the annotation record name.
optionsPCCViewer.ViewerControl~SaveMarkupOptions <optional> This optional parameter specifies options for the markup types to be saved. The PCCViewer.ViewerControl~SaveMarkupOptions details the options object.
Returns:
Returns given record name after record is saved.
- Type
- PCCViewer.Promise
Example
The following example will save all annotations and redaction merk types. It will not save signatures mark types. viewerControl.saveMarkup('cool name').then( function success(name) { alert('Markup was saved as "' + name + '"'); }, function fail(reason) { alert('Markup was not saved. ' + reason); } ); The following will save signatures mark types only. viewerControl.saveMarkup('cool name', {includeAnnotation: false, includeRedactions : false, includeSignatures: true}).then( function success(name) { alert('Markup was saved as "' + name + '"'); }, function fail(reason) { alert('Markup was not saved. ' + reason); } ); -
scrollTo(target) → {PCCViewer.ViewerControl}
-
Scrolls to the specified object.
Parameters:
Name Type Description targetPCCViewer.Mark | PCCViewer.Conversation | PCCViewer.SearchResult | Object The mark, conversation, search result, or an object (that contains pageNumber, x, and y values) to scroll to.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If target is not a valid PCCViewer.Mark or PCCViewer.SearchResult, or if it is not an Object with valid pageNumber, x, and y values.
-
- Type
- Error
-
-
-
If target is a PCCViewer.Mark, PCCViewer.Conversation, or PCCViewer.SearchResult unknown to the viewer control. When specifying a pageNumber greater than 1, this method requires that the PageCountReady event has been triggered, otherwise an error is thrown.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // scroll to the mark viewerControl.scrollTo(theFirstMark); -
-
search(searchQuery) → {PCCViewer.SearchRequest}
-
Searches the text of the document for the given
searchQuery.This query can be a single search term or a hash specifying one or more terms and options. If only a single search term (string) is supplied, then default options are used.
Search completes asynchronously. The returned PCCViewer.SearchRequest object, provides events for search progress and members to access search results.
Parameters:
Name Type Description searchQuerystring | PCCViewer.ViewerControl~SearchQuery A value specifying the search query. The value specifies a single search term (string) or an object specifying multiple search terms and options.
Throws:
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
Returns:
An object that represents the search request. This object allows the calling code to subscribe to search progress events and access search results.
Examples
// Search on a single term with default options var searchRequest = viewerControl.search("Hello"); // Subscribe to the PartialSearchResultsAvailable event to get search results as they become available. searchRequest.on('PartialSearchResultsAvailable', function(_event) { // Get the newly available search results. var newResults = _event.partialSearchResults; });// Search on multiple terms and specify options var searchQuery = { searchTerms: [{ searchTerm: "sub", contextPadding: 25, highlightColor: '#B22222', matchingOptions: { beginsWith: true, } }, { searchTerm: "Accusoft" }] }; var requestObject = viewerControl.search(searchQuery) //subscribe to the search request requestObject.on('PartialSearchResultsAvailable', function(_event) { var newResults = []; //Retrieve results newResults = _event.partialSearchResults; }); -
-
selectMarks(marks) → {PCCViewer.ViewerControl}
-
Selects the marks provided in the
Arrayparameter.Parameters:
Name Type Description marksArray.<PCCViewer.Mark> An array of PCCViewer.Mark objects that exist in the document and need to be selected.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to calling this method.
-
- Type
- Error
-
-
-
If any of the mark objects are not valid objects, the id of the mark provided does not match the id of mark loaded in the viewer, or the mark provided was not previously added to the document pages.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get all of the marks var allMarks = viewerControl.getAllMarks(); // select all of them viewerControl.selectMarks(allMarks); -
-
setConversationDOMFactory(factoryFunction) → {PCCViewer.ViewerControl}
-
Sets the conversation DOM factory function.
Parameters:
Name Type Description factoryFunctionfunction This function returns a DOM element that is injected in the viewer control UI, which should show information about the conversation. The viewer control will use this function to obtain a new conversation DOM element whenever:
- a comment is added
- a comment is removed
- a comment is modified
- a conversation is selected
- a conversation is deselected
- the PCCViewer.ViewerControl#refreshConversations method is called
If this function returns a falsy value, then the conversation will not be shown in the viewer control UI. If this function returns a value that is not a DOM element and not falsy, then the viewer control will throw an exception when attempting to create a conversation DOM element.
This function has three parameters, in this order:
conversation{PCCViewer.Conversation} - TheConversationin which to generate a DOM element.state{Object} - An object that indicates the state of the conversation. This object has anisSelectedboolean property.existingDOM{HTMLElement | undefined} - The DOM Element returned from the last call to this factory for the given conversation. It is acceptable to return this same element from the factory function if the DOM does not need to be replaced (for example, if it only needs modification or does not require any modification). This parameter may have a value ofundefinedif the factory function has never been called for this conversation or the previous call did not return a DOM element.
Throws:
-
If the
factoryFunctionparameter is not aFunction. -
- Type
- Error
Returns:
The
ViewerControlobject on which this method was called.Example
var conversationFactoryFunction = function(conversation, state, existingDOM) { var conversationDiv = document.createElement('div'); // Create a conversation DOM element. // Set the style of the conversation DOM element. conversationDiv.style.position = 'absolute'; if (state.isSelected) { // Set a different background if the conversation is selected. conversationDiv.style.backgroundColor = 'white'; } else { conversationDiv.style.backgroundColor = 'lightgray'; } conversationDiv.style.left = '10px'; conversationDiv.style.right = '0'; conversationDiv.style.textAlign = 'left'; // For each comment in the conversation, create a comment DOM element. var comments = conversation.getComments(); for (var i = 0; i < comments.length; i++) { var commentDiv = document.createElement('div'); // Set the style of the comment DOM element. commentDiv.style.position = 'relative'; commentDiv.style.padding = '5px'; commentDiv.style.border = '1px solid gray'; if (i > 0) { commentDiv.style.borderTop = 'none'; } commentDiv.appendChild(document.createTextNode(comments[i].getText())); // Add the comment text to the comment DOM element. conversationDiv.appendChild(commentDiv); // Add the comment DOM element to the conversation DOM element. } return conversationDiv; // Return the conversation DOM element. }; viewerControl.setConversationDOMFactory(conversationFactoryFunction); -
setCurrentMouseTool(name) → {PCCViewer.ViewerControl}
-
Sets the current mouse tool of the viewer by name.
See the help section titled "Custom Mouse Tools" for a list of the existing default mouse tools in the viewer.
Parameters:
Name Type Description namestring The name used when creating the mouse tool. This value is case-insensitive.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event has not fired prior to calling this method.
-
- Type
- Error
-
-
-
If the parameter name is invalid or is an unknown mouseTool type, see, PCCViewer.MouseTool.Type.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called. -
-
setPageLayout(pageLayout) → {PCCViewer.ViewerControl}
-
Sets the layout of the pages.
This property defines the placement or arrangement of the pages in the viewer. The default page layout is
"Vertical", in which the pages are displayed as a single vertical column and a vertical scroll bar is displayed to bring into view the pages that are not in view. The"Horizontal"option displays the pages as a single horizontal row and has a horizontal scroll bar to bring into view the pages that are not in the view.Comments are only supported when using vertical page layout. If the comments panel is open, setting the page layout to horizontal will close the comments panel.
Parameters:
Name Type Description pageLayoutPCCViewer.PageLayout Display pages using this layout.
- See:
Throws:
-
If the
pageLayoutvalue is unknown. -
- Type
- Error
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.setPageLayout(PCCViewer.PageLayout.Horizontal); -
setPageNumber(pageNumber) → {PCCViewer.ViewerControl}
-
Sets the current page of the viewer to the specified page number.
Parameters:
Name Type Description pageNumbernumber | string The 1-based page number of the page. A string representation of a valid number is also accepted as a parameter.
Throws:
-
-
If the parameter
pageNumberis less than 1 or greater than the value returned by PCCViewer.ViewerControl#getPageCount. -
- Type
- Error
-
-
-
If the parameter
pageNumberis not a number or a string representation of a number. -
- Type
- Error
-
-
-
If the parameter
pageNumberis not an integer page number. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// first create the pccViewer : Note: if the viewer object has already been created, do not re-create it. var viewerControl = $("#viewer").pccViewer(viewerOptions).viewerControl; var pageNumberSet = 2; function pageChangedHandler(event) { var pageNumber = viewer.getPageNumber(); if(pageNumber === pageNumberSet) { //now unsubscribe the event Note: do not unsubscribe if future notifications are required. viewerControl.off("PageChanged", pageChangedHandler); alert("Viewer was navigated to the desired page successfully"); } } // Subscribe to PageChanged event exposed by the API viewerControl.on("PageChanged", pagChangedHandler); viewerControl.setPageNumber(pageNumberSet); -
-
setSelectedConversation(conversation) → {PCCViewer.ViewerControl}
-
Sets the selected conversation.
Parameters:
Name Type Description conversationPCCViewer.Conversation The conversation to select.
Throws:
-
-
If PCCViewer.EventType.ViewerReady event was not fired prior to using this property.
-
- Type
- Error
-
-
-
If the
conversationparameter is not an instance of PCCViewer.Conversation. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
// get the first selected Mark object var theFirstMark = viewerControl.getSelectedMarks()[0]; // select the conversation of the Mark viewerControl.setSelectedConversation(theFirstMark.getConversation()); -
-
setSelectedSearchResult(searchResult, scrollTo) → {PCCViewer.ViewerControl}
-
Selects the specified search result and optionally navigates to the page of the search result.
If a value of
nullis passed in for thesearchResultparameter, then any currently selected result will be cleared/deselected.Parameters:
Name Type Argument Default Description searchResultPCCViewer.SearchResult | null The search result object from the results object. If a value of
nullis passed, then no search results will be selected.scrollToboolean <optional> false If true, the viewer will navigate to the page with the search result. If the value of
searchResultisnull, then this argument is ignored.- See:
Throws:
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If the
searchResultparameter is not an instance of PCCViewer.SearchResult ornull. -
- Type
- Error
-
-
-
If the
searchResultis not part of the currently known PCCViewer.SearchRequest, which is always the case if there is no current PCCViewer.SearchRequest object known to the viewer. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
var searchRequest = viewerControl.search('Accusoft'); // add events to the search request searchRequest.on("SearchCompleted", function(){ // get the search results results = searchRequest.getResults(); // set the result to the first viewerControl.setSelectedSearchResult(results[0], true); }); -
setViewMode(viewMode) → {PCCViewer.ViewerControl}
-
Sets the view mode.
When set to Document or EqualWidthPages, this property only has an effect on documents with different sized pages. Setting the view mode to
"Document"maintains the relative size of each page when displaying a document. For example, if page 2 is smaller than page 1, it will appear smaller. Setting the view mode to"EqualWidthPages"scales each page so that their width is the same. For example, if page 2 is smaller than page 1, it will be scaled larger so that its width is equal to the width of page 1.Setting the view mode to
"SinglePage"structures the viewer so that only a single page is shown at a time. Each page is scaled to fit within a view box, which is the initial size of the viewer and increases in size when zooming in (and decreases in size when zooming out). After the viewer initializes, the view mode may not be changed to or from SinglePage view mode (or an exception will occur).Parameters:
Name Type Description viewModePCCViewer.ViewMode Display pages using this mode.
- See:
Throws:
-
-
If the
viewModevalue is unknown. -
- Type
- Error
-
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to using this method.
-
- Type
- Error
-
-
-
If setting the value to "SinglePage". This value must be set during initialization time. See PCCViewer.ViewerControl~ViewerControlOptions for mode details on the
viewModeinitialization parameter. -
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.setViewMode(PCCViewer.ViewMode.EqualWidthPages); // Scale each page so that their width is the same. -
validatePrintRange(range) → {boolean}
-
Determines whether the range string is a valid page range to be used in PCCViewer.ViewerControl#print.
Parameters:
Name Type Description rangestring A string containing page numbers or ranges. See PCCViewer.ViewerControl#print.
Returns:
A value indicating whether the specified print range is valid.
- Type
- boolean
Example
viewerControl.validatePrintRange("1, 3-5"); // Returns true if there are at least 5 pages in the document. -
validateSearch(searchQuery) → {Object}
-
Validates each of the search terms in the
searchQueryobject. The validation process checks for valid custom regular expressions. This method is used by the default UI to filter out 'bad' pre-defined search terms.Parameters:
Name Type Description searchQuerystring | PCCViewer.ViewerControl~SearchQuery A string or a
SearchQueryobject that requires validation. See PCCViewer.ViewerControl#search.Returns:
Returns an object with two summary properties and an array of objects that indicate whether each search term is valid. The array will be the same length as the array searchQuery.searchTerms. Objects contain the following properties:
errorsExist{boolean} True if any validation errors exist. False if not.summaryMsg{string} (optional) A catch all message for cases where the search terms could not be reached for validation. This might occur if thesearchQeuryobject is badly formed with improper key names or the viewer sends in an invalid object type (say boolean)- array of objects:
isValid{boolean} Indicates if the search term of the matching index was valid.message{string} Provides a human readable message indicating the reason the search term was invalid.
- Type
- Object
Example
var searchQuery = { searchTerms: [ { searchTerm: '(?<=(category=))[a-z-]+', // invalid regex contextPadding: 25, highlightColor: '#B22222', matchingOptions: { beginsWith: false, endsWith: false, exactPhrase: false, matchCase: true, matchWholeWord: false, wildcard: false } } ] } viewerControl.validateSearch(searchQuery) // returns { errorsExist: true, searchTerms: [ { isValid: false, message: "Search term must be a string containing either plain text or a valid regular expression." } ] } -
zoomIn(zoomFactor) → {PCCViewer.ViewerControl}
-
Zoom in on the document by the specified
zoomFactor.Note: The viewer has minimum and maximum scale limits.
zoomInwill only change the viewer's scale up to, but not past, the maximum scale limit.zoomIndoes not give an indication if the actual scale change was less than the requested zoom factor because the limit was reached. Instead, check PCCViewer.ViewerControl#atMaxScale to determine if the viewer is at max scale.Parameters:
Name Type Description zoomFactornumber Zoom in by this factor. Valid values are between
1.01and20Throws:
-
-
If the
zoomFactorvalue is invalid. -
- Type
- Error
-
-
-
If the PCCViewer.EventType.ViewerReady event was not fired prior to calling this method.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.zoomIn(1.5); // Zoom in by 1.5x, or to the maximum scale. viewerControl.zoomIn(5); // Zoom in by 5x, or to the maximum scale. viewerControl.zoomIn(100); // Throws! viewerControl.zoomIn(1); // Throws! -
-
zoomOut(zoomFactor) → {PCCViewer.ViewerControl}
-
Zoom out on the document by the specified
zoomFactor.Note: The viewer has minimum and maximum scale limits.
zoomOutwill only change the viewer's scale down to, but not past, the minimum scale limit.zoomOutdoes not give an indication if the actual scale change was less than the requested zoom factor because the limit was reached. Instead, check PCCViewer.ViewerControl#atMinScale to determine if the viewer is at minimum scale.Parameters:
Name Type Description zoomFactornumber Zoom out by this factor. Valid values are between
1.01and20.Throws:
-
-
If the
zoomFactorvalue is invalid. -
- Type
- Error
-
-
-
If the PCCViewer.EventType.ViewerReady event has not fired prior to calling this method.
-
- Type
- Error
-
Returns:
The
ViewerControlobject on which this method was called.Example
viewerControl.zoomOut(1.5); // Zoom out by 1.5x, or to the minimum scale. viewerControl.zoomOut(5); // Zoom out by 5x, or to the minimum scale. viewerControl.zoomOut(100); // Throws! viewerControl.zoomOut(1); // Throws! -
Type Definitions
-
SaveMarkupOptions
-
The PCCViewer.SaveMarup API method takes a second optional parameter. This parameter is in a form an object and provides options for saving marks to the server.
Type:
- Object
-
Properties:
-
Name Type Argument Default Description includeAnnotationsboolean <optional> true Indicates whether annotation marks types should be saved.
includeSignaturesboolean <optional> false Indicates whether signature mark types should be saved.
includeRedactionsboolean <optional> true Indicates whether redactio mark types should be saved.
-
-
SearchMatchingOptions
-
This object is used to specify search options. It will be used in a PCCViewer.ViewerControl~SearchTerm object.
Type:
- Object
-
Properties:
-
Name Type Argument Default Description endsWithboolean <optional> false Match a phrase that ends with the search term. The matched phrase will be the shortest phrase that starts on a word boundary and ends with the matched phrase.
beginsWithboolean <optional> false Match a phrase that starts with the search term. The matched phrase will be the shortest phrase that starts with the matched phrase and ends on a word boundary.
If this value is
true, then the following options are ignored:endsWith
exactPhraseboolean <optional> true Indicates whether the entire
searchTermis treated as a single phrase or if it is split on white space and individual words are matched based on the search options.If this value is
true, then the following options are ignored:wildcard
matchCaseboolean <optional> false Indicates whether matching is case sensitive.
matchWholeWordboolean <optional> false Match a phrase that starts and ends on word boundaries.
If this value is
true, then the following options are ignored:wildcardendsWithbeginsWith
wildcardboolean <optional> false A value that indicates whether the search term includes wild cards.
Supported wildcard characters are:
- '*' - match one or more characters
- '?' - match one character
If this value is
true, then the following options are ignored:endsWithbeginsWith
-
Example
// A simple matching options object var myMatchingOptions = { beginsWith: true, }; // The matching options object is used in a search term object var searchTerm = { searchTerm: "sub", contextPadding: 25, highlightColor: '#B22222', matchingOptions: myMatchingOptions }; // The search term object is used in the search query object var searchQuery = { searchTerms: [searchTerm] }; -
SearchQuery
-
This object is used to specify one or more search terms and options for the PCCViewer.ViewerControl#search method.
Type:
- Object
-
Properties:
-
Name Type Description searchTermsArray.<PCCViewer.ViewerControl~SearchTerm> An array of search terms.
-
Example
// An example search query object with one search term var searchQuery = { searchTerms: [{ searchTerm: "sub", contextPadding: 25, highlightColor: '#B22222', matchingOptions: { beginsWith: true, } }] }; -
SearchTerm
-
This object is used to specify one search term and its options. It will be used in the PCCViewer.ViewerControl~SearchQuery object that is passed to the PCCViewer.ViewerControl#search method.
Type:
- Object
-
Properties:
-
Name Type Argument Default Description searchTermstring A string value to match against. This may be treated as a string literal, a string with wild cards, or a regular expression. See
searchTermIsRegexand PCCViewer.ViewerControl~SearchMatchingOptions.contextPaddingnumber <optional> 25 The maximum number of leading and trailing character in the context string (PCCViewer.SearchResult#getContext) that is given for a search result.
highlightColorstring <optional> The highlight color of the search results matching this search term (PCCViewer.SearchResult#getHighlightColor).
If not defined, then a color will be chosen. A different color will be chosen for each search term, and if
matchingOptions.exactPhrase === false, then a different color will be chosen for each word in the search term.matchingOptionsPCCViewer.ViewerControl~SearchMatchingOptions <optional> Options that specify how the search term will be matched.
searchTermIsRegexboolean <optional> false Indicates if the search term is treated as a regular expression.
If this value is
true, then the following matching options can be used:matchingOptions.matchCase
Note that it is invalid to set the other matching options for a regular expression search. Doing so may make search behave in unexpected ways.
-
Example
// An example search term object var searchTerm = { searchTerm: "sub", contextPadding: 25, highlightColor: '#B22222', matchingOptions: { beginsWith: true, } }; // The search term is used in a search query object. // There can be many search term objects in a search query object. var searchQuery = { searchTerms: [searchTerm] }; -
ViewerControlOptions
-
These options are available and processed directly by the ViewerControl. When using the jQuery Plugin, jQuery.fn.pccViewer, these options can be passed in along with jQuery.fn.pccViewer~Options, and they will be passed into ViewerControl.
Type:
- Object
-
Properties:
-
Name Type Argument Default Description documentIDstring REQUIRED The ID of the document to load.
imageHandlerUrlstring REQUIRED The end point of the web tier services that support the viewer.
languageObject <optional> Specifies the language to use for the text in the ViewerControl.
The options here are a subset of the jQuery.fn.pccViewer~LanguageOptions object. These values are used directly by the ViewerControl, and are passed in by the jQuery Plugin, jQuery.fn.pccViewer. When creating a custom UI using ViewerControl directly, these options will need to be passed in during initialization. If they
languageelement is not present with the following properties, ViewerControl will use the English language defaults.Properties
Name Type Argument Default Description pageLoadFailedstring <optional> "Page Load Failed" Text to use for "Page Load Failed"
pageLoadFailedRetrystring <optional> "Retry" Text to use for "Retry"
viewModestring <optional> "Document" The mode used to view documents containing different sized pages. See the PCCViewer.ViewMode enumeration for details on each view mode.
pageLayoutstring <optional> "Vertical" The layout used to arrange pages in the viewer. See the PCCViewer.PageLayout enumeration for details on each page layout.
pageRotationnumber <optional> 0 The amount in degrees clockwise to rotate each page. Valid values are multiples of 90: ...,
-270,-180,-90,0,90,180,270, ...resourcePathstring <optional> "img" The location of the images within the viewer. This is the folder that holds the ArtMarkHandles.png and EditTextMark.png files. This path should be relative to the page that the viewer is embedded on.
printTemplatestring <optional> "" A text representation of a full web page used for printing purposes. It is recommended that this value be set to the content of the file "printTemplate.html". If this value is set to an empty string (default), then printing will be unavailable.
template.printstring <optional> "" This is an alias for
printTemplate. IfprintTemplateis not available in theoptionsobject, the control will look for this property instead. This property matches the value as it is used in the jQuery plugin options (jQuery.fn.pccViewer~Options).encryptionboolean <optional> false Specifies whether the viewer should use encryption. See the help topic "Enabling Content Encryption" for more details.
serviceResponseTimeoutnumber <optional> 60000 Indicates the response timeout interval for all services to the server. A value of zero indicates the default browser value will be used.
debugboolean <optional> false Indicates whether the viewer should log its actions.
-