import { Viewer, DocumentGate } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { Stage, stagePlugin } from '@embedpdf/react/stage'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { SelectionLayer, selectionPlugin } from '@embedpdf/react/selection'; import { interactionPlugin } from '@embedpdf/react/interaction'; import { AnnotationLayer, annotationPlugin, useAnnotationState } from '@embedpdf/react/annotation'; import { localEngine } from '@embedpdf/engine'; import './layer.css'; const engine = localEngine(); const plugins = [ stagePlugin(), renderPlugin(), interactionPlugin(), selectionPlugin(), annotationPlugin(), ]; const report = async (): Promise => { const response = await fetch('https://www.embedpdf.com/pdfs/report.pdf'); return { kind: 'bytes', id: 'report', bytes: new Uint8Array(await response.arrayBuffer()) }; }; function Status() { const { status, selected } = useAnnotationState(); let text = 'Click an annotation to select it'; if (status === 'loading') text = 'Loading the annotations…'; else if (selected.length > 0) text = `Selected: ${selected.map((a) => a.subtype).join(', ')}`; return (

{text}

); } export default function App() { return ( Loading…

}> {() => ( <> )}
); }