Add clickable link support (annotations + text-detected URLs)#9
Merged
Conversation
Extract link annotations (URI + internal GoTo) via FPDFLink_Enumerate and auto-detected web links (FPDFLink_LoadWebLinks, e-mails as mailto:) on all five backends (JVM/Android JNI, iOS cinterop, JS/wasmJs worker). PdfPage gains a clickable link overlay (hand cursor, accessibility semantics); external URIs open via LocalUriHandler, internal GoTo links scroll PdfReader to the destination page, and onLinkClick allows interception.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8
Summary
PdfLink/PageLinks(bounds in PDF points,uri,destPageIndex),PdfDocument.pageLinks()and publicPdfReaderState.pageLinks(pageIndex).FPDFLink_Enumerate— URI actions and internal GoTo destinationsFPDFLink_LoadWebLinks— URLs and e-mail addresses detected in the page text (PDFium returns e-mails asmailto:URIs)PdfPagegainslinksEnabled: Boolean = trueandonLinkClick: ((PdfLink) -> Boolean)?: an invisible clickable overlay per link rect, hand cursor on desktop, click semantics for accessibility, and correct touch-scroll interplay. External URIs open throughLocalUriHandler;onLinkClickreturningtrueconsumes the click.PdfReaderscrolls to the destination page for internal GoTo links and exposes the samelinksEnabled/onLinkClickknobs.nCountPageLinks/nExtractPageLinksin the sharedpdfium_jni.cpp; JVM degrades to empty links if a prebuilt native predates the APIfpdf_doc.h/fpdf_text.halready exposed by the.def)linksop inpdfium_worker.mjs(the shippedpdfium.wasmalready exportsFPDFLink_*)jumpToPage; README documents the feature.Test plan
smokeTestagainst a 2-page PDF containing all four link kinds — URI annotation, internal GoTo (dest=1), text-detected URL, text-detected e-mail (mailto:) — all extracted correctlybuildJniMacOs/buildJniWindows) before publishing