PrizmDoc Viewer v13.25 Release - Updated
PrizmDoc Viewer / 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.

    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));
        }
    );
    
    
    See:

    Members

    (readonly) href :string|number

    Gets the link target for DocumentHyperlink.

    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;
    }
    
    

    Type:

    • string | number
    See:

    (readonly) pageNumber :number

    Gets the page number where the DocumentHyperlink object is located.

    Example

    var pageNumber = myDocumentHyperlink.pageNumber;
    
    

    Type:

    • number
    See:

    (readonly) rectangle :number

    Gets the bounding rectangle for the DocumentHyperlink. The returned object has the type {x: xValue, y: yValue, width: widthValue, height: heightValue}.

    Example

    var boundingRectangle = myDocumentHyperlink.rectangle;
    
    

    Type:

    • number
    See:

    Methods

    getHref() → {string|number}

    Gets the link target for DocumentHyperlink.

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

    Returns:

    The link target.

    A number value indicates that the target is a page number within the document.

    Type
    string | number

    getPageNumber() → {number}

    Gets the page number where the DocumentHyperlink object is located.

    Example

    var pageNumber = myDocumentHyperlink.getPageNumber();
    
    
    See:

    Returns:

    The page number where the DocumentHyperlink is located.

    Type
    number

    getRectangle() → {Object}

    Gets the bounding rectangle for the DocumentHyperlink.

    Example

    var boundingRectangle = myDocumentHyperlink.getRectangle();
    
    
    See:

    Returns:

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

    Type
    Object

    Documentation generated by JSDoc 3.6.10 on Thu Sep 21 2023 17:47:52 GMT+0000 (Coordinated Universal Time)