import { useState } from 'react'; 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 { interactionPlugin } from '@embedpdf/react/interaction'; import { AnnotationLayer, annotationPlugin } from '@embedpdf/react/annotation'; import { localEngine } from '@embedpdf/engine'; import './annotations.css'; const engine = localEngine(); const plugins = [stagePlugin(), renderPlugin(), interactionPlugin(), annotationPlugin()]; // [!doc-source report] 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()) }; }; // [!/doc-source] type Painter = 'picture' | 'layer'; export default function App() { const [painter, setPainter] = useState('picture'); return ( Loading…

}>

{painter === 'picture' ? 'Part of the picture: it can’t be picked up.' : 'Left out of the picture: click it, then drag it.'}

{() => painter === 'picture' ? ( ) : ( <> ) }
); }