import { useEffect } 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,
useInteraction,
useInteractionState,
} from '@embedpdf/react/interaction';
import {
AnnotationLayer,
annotationPlugin,
useAnnotation,
useAnnotationSettings,
} from '@embedpdf/react/annotation';
import { localEngine } from '@embedpdf/engine';
import './after-create.css';
const engine = localEngine();
const plugins = [stagePlugin(), renderPlugin(), interactionPlugin(), annotationPlugin()];
const sketch = async (): Promise => {
const response = await fetch('https://www.embedpdf.com/pdfs/sketch.pdf');
return { kind: 'bytes', id: 'sketch', bytes: new Uint8Array(await response.arrayBuffer()) };
};
function AfterDrawing() {
const annotation = useAnnotation();
const interaction = useInteraction();
const { activeToolId } = useInteractionState();
const afterCreate = useAnnotationSettings((settings) => settings.afterCreate);
// The rectangle tool is active on load.
useEffect(() => {
interaction.activateTool('square');
}, [interaction]);
return (
);
}
export default function App() {
return (
Loading…
}>
{() => (
<>
>
)}
);
}