KiteLinkAction

sealed class KiteLinkAction(source)

A link that the reader tapped, handed to KiteDocView's onLinkTap before the viewer acts on it. Every format gives the same facts, so most hosts need no when:

Each subclass keeps its format's own link for what these leave out. Pdf holds the parsed PdfAction: a go-to, a URI, a Launch, JavaScript, a form submit. Epub holds the EpubLink, whose href EpubDocument.linkTarget reads. Plain holds the KiteLink of an XPS or SVG page.

A document can name any scheme, file:, intent: and javascript: included, so open only the ones you trust:

onLinkTap = { link ->
val uri = link.uri
if (uri != null && (uri.startsWith("https://") || uri.startsWith("http://"))) {
openInBrowser(uri)
true
} else {
false // the viewer follows a link inside the document
}
}

Inheritors

Types

Link copied to clipboard

An EPUB link. EpubDocument.linkTarget reads the element that its EpubLink.href points at.

Link copied to clipboard

A PDF link, or the action of a form widget that the viewer does not perform itself, with its parsed action untouched.

Link copied to clipboard

A link of a page that gives plain links, such as an XPS or an SVG page.

Properties

Link copied to clipboard
open val kind: KiteLinkKind

What the link is for. EPUB books mark their references to notes, glossary entries and bibliography entries. KitePDF reads no such marks from the other formats yet, so their links are KiteLinkKind.LINK.

Link copied to clipboard
abstract val pageIndex: Int

The index of the page that holds the link.

Link copied to clipboard
abstract val rect: KiteRectangle

The link's area on its page, in display space: points from the page's top-left corner, y down, with the smaller y in KiteRectangle.bottom.

Link copied to clipboard
abstract val target: KiteBookmark?

The place inside the document that the link leads to, or null for a link that leads out of it.

Link copied to clipboard
abstract val uri: String?

The address outside the document that the link leads to, or null for a link inside it.