Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
MuPDF 1.27.0
Logo
MuPDF 1.27.0

Guides

  • What is MuPDF?
  • License
  • Installing
  • Using with Javascript
  • Using with Java
  • Using with Android
  • Tools
    • mupdf-gl
    • mutool
    • mutool audit
    • mutool bake
    • mutool barcode
    • mutool clean
    • mutool convert
    • mutool create
    • mutool draw
    • mutool extract
    • mutool grep
    • mutool info
    • mutool merge
    • mutool pages
    • mutool poster
    • mutool recolor
    • mutool run
    • mutool show
    • mutool sign
    • mutool trace
    • mutool trim

Cookbook

  • MuPDF Explored
  • C Examples
    • Render Images
    • Multi-threaded
    • Stories
  • Progressive Loading
  • Javascript Examples
    • Basics
    • Advanced

Reference

  • Concepts
    • Glossary
    • Coordinate Systems
    • Document Writer Options
    • PDF Write Options
    • Structured Text Options
  • C Library
    • Introduction
    • Overview
    • Coding Style
    • Fitz
      • Context
      • Errors
      • Memory
      • Colors
      • Data Structures
      • Buffers & Streams
      • Math
      • Pixmaps
      • Strings
      • XML Parser
    • PDF
  • Javascript Library
    • Introduction
    • Functions
    • Types
      • Archive
      • Buffer
      • Color
      • ColorSpace
      • DOM
      • DefaultColorSpaces
      • Device
      • DisplayList
      • DisplayListDevice
      • Document
      • DocumentWriter
      • DrawDevice
      • Font
      • Image
      • Link
      • LinkDestination
      • Matrix
      • MultiArchive
      • OutlineItem
      • OutlineIterator
      • Page
      • Path
      • PathWalker
      • Pixmap
      • Point
      • Quad
      • Rect
      • Shade
      • Story
      • StrokeState
      • StructuredText
      • StructuredTextWalker
      • Text
      • TextWalker
      • TreeArchive
      • PDFAnnotation
      • PDFDocument
      • PDFFilespecParams
      • PDFGraftMap
      • PDFObject
      • PDFPage
      • PDFProcessor
      • PDFWidget
  • C++, Python, and C#

Other

  • Change Log
  • Third Party Libraries
Back to top

Link¶

Link objects contain information about page links, such as their bounding box and their destination URI.

To determine whether a link is document-internal or an external link to a web page, see Link.prototype.isExternal(). Finally, to resolve a document-internal link see Document.prototype.resolveLinkDestination().

Constructors¶

class Link()¶

You cannot create instances of this class with the new operator!

To obtain the links on a page see Page.prototype.getLinks().

To create a new link on a page see Page.prototype.createLink().

Instance methods¶

Link.prototype.getBounds()¶

Returns a rectangle describing the link’s location on the page.

Returns:

Rect

var rect = link.getBounds()
Link.prototype.setBounds(rect)¶

Sets the bounds for the link’s location on the page.

Arguments:
  • rect (Rect) – Desired bounds for link.

link.setBounds([0, 0, 100, 100])
Link.prototype.getURI()¶

Returns a string URI describing the link’s destination. If isExternal() returns true, this is a URI suitable for a browser, if it returns false pass it to Document.prototype.resolveLink to access to the destination page in the document.

Returns:

string

var uri = link.getURI()
Link.prototype.setURI(uri)¶

Sets this link’s destination to the given URI. To create links to other pages within the document, see Document.prototype.formatLinkURI().

Arguments:
  • uri (string) – An URI describing the desired link destination.

Link.prototype.isExternal()¶

Returns a boolean indicating if the link is external or not. URIs whose link URI has a valid scheme followed by colon, e.g. https://example.com and mailto:test@example.com, are defined to be external.

Returns:

boolean

var isExternal = link.isExternal()
Next
LinkDestination
Previous
Image
Copyright © 2004-2026 Artifex
Made with Furo
Last updated on March 20, 2026
Find #mupdf on Discord
On this page
  • Link
    • Constructors
      • Link
    • Instance methods
      • getBounds
      • setBounds
      • getURI
      • setURI
      • isExternal