Constructor
new DocumentHyperlink()
NOTE: this constructor is for internal use only.
DocumentHyperlinks cannot be added via the API, they can only be retrieved via the PCCViewer.ViewerControl#requestDocumentHyperlinks method.
Example
var viewerControl = new PCCViewer.ViewerControl(...);
// use PCCViewer.ViewerControl#requestDocumentHyperlinks(pageNumber)
viewerControl.requestDocumentHyperlinks(1).then(
function (documentHyperlinks) {
// do something with the documentHyperlinks
documentHyperlinks.forEach(function(dh) {
// ...
});
},
function (error) {
alert("Something went wrong " + (error.message ? error.message : error));
}
);
Members
(readonly) href :string|number
Gets the link target for DocumentHyperlink.
Type:
- string | number
Example
var href = documentHyperlink.href;
switch (typeof href) {
case "number":
// navigate to the page
viewerControl.setPageNumber(href);
break;
case "string":
default:
// Interpret the URL and execute the navigation.
window.location.href = href;
break;
}
(readonly) pageNumber :number
Gets the page number where the DocumentHyperlink object is located.
Type:
- number
Example
var pageNumber = myDocumentHyperlink.pageNumber;
(readonly) rectangle :number
Gets the bounding rectangle for the DocumentHyperlink. The returned object has the type {x: xValue, y: yValue, width: widthValue, height: heightValue}
.
Type:
- number
Example
var boundingRectangle = myDocumentHyperlink.rectangle;
Methods
getHref() → {string|number}
Gets the link target for DocumentHyperlink.
Returns:
The link target.
A number value indicates that the target is a page number within the document.
- Type
- string | number
Example
var href = documentHyperlink.getHref();
switch (typeof href) {
case "number":
// navigate to the page
viewerControl.setPageNumber(href);
break;
case "string":
default:
// Interpret the URL and execute the navigation.
window.location.href = href;
break;
}
getPageNumber() → {number}
Gets the page number where the DocumentHyperlink object is located.
Returns:
The page number where the DocumentHyperlink is located.
- Type
- number
Example
var pageNumber = myDocumentHyperlink.getPageNumber();
getRectangle() → {Object}
Gets the bounding rectangle for the DocumentHyperlink.
Returns:
A rectangle object of the type {x: xValue, y: yValue, width: widthValue, height: heightValue}
.
- Type
- Object
Example
var boundingRectangle = myDocumentHyperlink.getRectangle();