A PDF action is similar to a web hyperlink, but it’s much more flexible. PSPDFKit for Web implements common actions as defined in Adobe’s PDF Reference (page 417ff).
|Action||PSPDFKit Class||Use Case|
||Go to a destination (page) in the current document.|
||Resolve a Uniform Resource Identifier (web link).|
||Send data to a Uniform Resource Locator.|
||Set fields to their default values.|
A GoTo action can define a different
pageIndex in the same document. Clicking on it updates the scroll position to make the page visible, but it doesn’t update the zoom level.
A URI action contains a URI. When executing this annotation, PSPDFKit uses
window.open to create a new browser tab, which also clears the opener as a security measurement to avoid allowing the target page to have access to your PDF state:
let newWindow = window.open(action.uri, "_blank"); newWindow.opener = null;
var newWindow = window.open(action.uri, "_blank"); newWindow.opener = null;
You can learn more about the security problems when using
_blank in this article from JitBit.
Please refer to an individual browser’s documentation for a list of supported URI protocols. The most used protocols (
mailto) are supported in all major browsers.