import { useEffect } from 'react'; import { Viewer, DocumentGate, usePageList } 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 { SelectionLayer, selectionPlugin, useSelection } from '@embedpdf/react/selection'; import { cloudEngine } from '@cloudpdf/engine'; import './basic.css'; const engine = cloudEngine(); const plugins = [stagePlugin(), renderPlugin(), interactionPlugin(), selectionPlugin()]; const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' }; // Something to see on load: "Documents", the first word on the cover, selected from code. function SelectTitle() { const selection = useSelection(); const cover = usePageList()[0]?.ref; useEffect(() => { if (cover) selection.select({ page: cover, start: 36, count: 9 }); }, [selection, cover]); return null; } export default function App() { return ( Loading…

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