Web SDKv1.0.0

PDFViewer.toolBlockedReason()

Why the open document forbids a tool — { reason, message }: reason is 'permission' (the document's permissions), 'certified' (its certification) or 'downloading' (it edits, and the document's bytes are still arriving), message the words in the viewer's language ("This document does not allow comments") — or null when it allows it. A tool it forbids is still offered, grayed out with the message. A host drawing its own chrome shows the same, and branches on reason.
methodToolssince 1.0.0

Signature

toolBlockedReason(tool: ToolName): ToolBlockedReason | null

Parameters

ParameterTypeDescription
toolToolNameThe tool to ask about.

Returns

ToolBlockedReason | null { reason, message }, or null when the document allows it (and on a destroyed viewer).

Example

TypeScript
const blocked = viewer.toolBlockedReason('note');
noteButton.disabled = blocked !== null;
noteButton.title = blocked?.message ?? '';

More in PDFViewer