The PDF Viewer library allows you to lock the rectangle or square annotations using the isLock property in the rectangleSettings.
Step 1: Follow the steps provided in the link to create simple PDF Viewer sample in React.
Step 2: Add the following code snippet to lock the rectangle or square annotations.
<PdfViewerComponent
id="container"
documentPath="PDF_Succinctly.pdf"
serviceUrl="https://ej2services.syncfusion.com/production/web-services/api/pdfviewer"
// lock annotation
rectangleSettings={{ isLock: true }}
style={{ height: '640px' }}>
</PdfViewerComponent>
Find the Sample how to lock square or rectangle annotations