pdfrx_web
    Preparing search index...

    Function useAnnotations

    • The document's annotations, reloaded whenever the document changes and whenever an annotation is added/updated/removed — from these methods or from the user editing in the viewer (the annotationsChanged event).

      Returns PdfAnnotationsState

      The current annotations state and actions.

      const { annotations, add } = useAnnotations();
      // draw a red rectangle on page 1
      await add(1, { subtype: 'square', rect: { left: 50, top: 700, right: 200, bottom: 640 },
      color: { r: 220, g: 30, b: 30, a: 255 }, borderWidth: 2 });