File: Link.rst

package info (click to toggle)
mupdf 1.27.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,224 kB
  • sloc: ansic: 335,320; python: 20,906; java: 7,520; javascript: 2,213; makefile: 1,152; xml: 675; cpp: 639; sh: 513; cs: 307; awk: 10; sed: 7; lisp: 3
file content (79 lines) | stat: -rw-r--r-- 1,941 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
.. default-domain:: js

.. highlight:: javascript

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

	|no_new|

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

.. method:: Link.prototype.getBounds()

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

	:returns: `Rect`

	.. code-block::

		var rect = link.getBounds()

.. method:: Link.prototype.setBounds(rect)

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

	:param Rect rect: Desired bounds for link.

	.. code-block:: javascript

		link.setBounds([0, 0, 100, 100])

.. method:: 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

	.. code-block::

		var uri = link.getURI()

.. method:: 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()`.

	:param string uri: An URI describing the desired link destination.

.. method:: 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

	.. code-block::

		var isExternal = link.isExternal()