Creating Link Annotations with Text
It might happen that you’ve created a link annotation but it’s empty and you want to set the text. Link annotations don’t actually include the text that’s shown; rather, they should be overlaid on top of existing annotations to perform specific actions when clicked (link annotations themselves are invisible).
If you want to create a regular text link, create a link annotation that has the same bounding box as an existing text annotation you created, like so:
const uriAction = new PSPDFKit.Actions.URIAction({ uri: "https://pspdfkit.com" }); const linkAnnotation = new PSPDFKit.Annotations.LinkAnnotation({ pageIndex: existingTextAnnotation.pageIndex, boundingBox: existingTextAnnotation.boundingBox, action: uriAction }); instance.create(linkAnnotation);
Link annotations can also be used for other annotation and action types. Refer to the the API docs for more information.