Skip to content
ComPDF
DemoAPI ReferenceFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Guides

Annotation Visibility

ComPDF SDK supports controlling the visibility of annotations in the current document using CPDFConfiguration or CPDFReaderView.

The following examples demonstrate how to show or hide annotations:

Using CPDFConfiguration to Control Annotation Visibility

tsx
<CPDFReaderView
  ref={pdfReaderRef}
  document={samplePDF}
  configuration={ComPDFKit.getDefaultConfig({
    readerViewConfig: {
      annotationsVisible: true
    }
  })}
  />

Using CPDFReaderView to Control Annotation Visibility

tsx
// Check if annotations are currently visible
const visible = await pdfReaderRef.current?.isAnnotationsVisible();
// Show annotations
await pdfReaderRef.current?.setAnnotationsVisible(true);
// Hide annotations
await pdfReaderRef.current?.setAnnotationsVisible(false);