ActivateWebLinks

Annotations, hotspot links, and text extraction

Description

Detects web addresses and email addresses in existing page text and creates non-duplicate Link annotations with URI actions

Syntax

Function TPDFlib.ActivateWebLinks(Const PageRange: WideString): Integer;

Parameters

PageRangePage numbers and ranges such as 1,3,5-8; an empty value selects every page

Return values

Returns the number of new link annotations created

Remarks

The default detector recognises http://, https://, www., ftp://, mailto:, and bare email addresses; www. targets gain an https:// scheme and bare addresses gain a mailto: scheme

Each page is extracted once, link rectangles are derived from the matched character advances, and non-axis-aligned text receives /QuadPoints when the active PDF conformance permits PDF 1.6 features

An existing URI link with the same canonical target and a substantially overlapping rectangle is retained, making repeated calls idempotent

Detection uses ASCII URI syntax; encode non-ASCII host names and paths with Punycode or percent encoding before calling this method

Tagged PDF and PDF/UA documents are left unchanged because inserting an annotation without updating its structure-tree association would break conformance; the method returns 0 and sets LastErrorCode to PDFLIB_ERROR_TAGGED_LINK_STRUCTURE

The method reports per-page progress, honours cancellation, and restores the selected page

See also

ActivateWebLinksEx, AddLinkToWeb, SetAutoCreateWebLinks