Disable PDF editing and annotations
By setting the correct permissions, you can run Nutrient Web SDK in read-only mode, thereby preventing users from editing or annotating a PDF document. Get additional resources by visiting our guide about customizing annotation permissions.
import PSPDFKit from "@nutrient-sdk/viewer";
export function load(defaultConfiguration) { // Set the `readOnly` flag in the `initivalViewState` to true to disable // creating, editing or deleting annotations. // https://www.nutrient.io/api/web/PSPDFKit.ViewState.html#readOnly const initialViewState = new PSPDFKit.ViewState({ readOnly: true, });
return PSPDFKit.load({ ...defaultConfiguration, initialViewState }).then( (instance) => { return instance; } );}
This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.