This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/knowledge-base/observe-document-editor-visibility.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Observe PDF Document Editor visibility | Nutrient

If you need to be notified when Document Editor is displayed or hidden, use the viewState.change event listener to check whether or not Document Editor is being displayed:

// Add the event listener to the instance.
instance.addEventListener(
"viewState.change",
(viewState, previousState) => {
// Check if the current view state is "document_editor."
if (
viewState.interactionMode?.toLowerCase() === "document_editor"
) {
console.log("Document Editor Displaying");
}
// If the previous view state is "document_editor," the document editor was closed.
if (
previousState.interactionMode?.toLowerCase() === "document_editor"
) {
console.log("Document Editor Hidden");
}
}
);

This has been tested with Nutrient Web SDK 2020.6.4.