KiteLinkAction
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:
uri: the address outside the document, such as
https://example.com, or null.target: the place inside the document, or null.
kind: what the link is for, such as a reference to a note.
pageIndex and rect: where the link sits, for example to place a popup next to it with KiteDocViewState.displayRectToViewport.
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
An EPUB link. EpubDocument.linkTarget reads the element that its EpubLink.href points at.
A PDF link, or the action of a form widget that the viewer does not perform itself, with its parsed action untouched.
A link of a page that gives plain links, such as an XPS or an SVG page.
Properties
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.
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.
The place inside the document that the link leads to, or null for a link that leads out of it.