PrizmDoc Viewer v13.19 - Updated
API Reference / Viewer Control / Namespace: PCCViewer / Class: DocumentHyperlink
In This Topic
    Class: DocumentHyperlink
    In This Topic

    PCCViewer. DocumentHyperlink

    The PCCViewer.DocumentHyperlink object represents hyperlinks in the original document.

    There are two types of hyperlinks that can appear in a document, a DocumentHyperlink and a hyperlink drawn by an end user with the viewer's markup system, a "Markup hyperlink".

    At a high level, these two different types of hyperlinks behave the same:

    1. They can be clicked and the hyperlink followed.

    There are several differences between the DocumentHyperlink and a Markup hyperlinks:

    1. DocumentHyperlinks are written into the original document by the author of the original document. They are parsed out by the PrizmDoc Server and sent to the client viewer.
    2. Markup hyperlinks are created by an end user of the viewer and saved and loaded with the rest of the markup in the viewer.
    3. DocumentHyperlinks are immutable.
      • Their attributes href, position, and styling cannot be modified.
      • They cannot be deleted.
      • They cannot be added.
    4. Markup hyperlinks have full CRUD operation support via the API and mouse tools.
    5. DocumentHyperlinks are loaded with the document.
    6. Markup hyperlinks are loaded with the rest of the markup, which may be at the discretion of the end user or of the application embedding the PrizmDoc Viewing Client.

    Constructor

    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.

    See:

    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
    See:

    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
    See:

    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
    See:

    Example

    var boundingRectangle = myDocumentHyperlink.rectangle;
    

    Methods

    getHref() → {string|number}

    Gets the link target for DocumentHyperlink.

    See:

    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.

    See:

    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.

    See:

    Returns:

    A rectangle object of the type {x: xValue, y: yValue, width: widthValue, height: heightValue}.

    Type
    Object

    Example

    var boundingRectangle = myDocumentHyperlink.getRectangle();
    

    Documentation generated by JSDoc 3.3.3 on Wed Jan 19 2022 03:44:38 GMT-0500 (Eastern Standard Time)