import { Viewer, DocumentGate, useDocument, useDocuments } 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 { cloudEngine } from '@cloudpdf/engine'; import './open.css'; const engine = cloudEngine(); const plugins = [stagePlugin(), renderPlugin()]; const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' }; function Toolbar() { const documents = useDocuments(); const { id, name, status, pageCount } = useDocument(); // A file the user picks opens next to the welcome, and becomes the active document. const openFile = async (file: File) => { await documents.open({ kind: 'bytes', bytes: await file.arrayBuffer() }, { name: file.name }); }; return (
{id ? 'Opening…' : 'No document is open. Open a PDF to see it here.'}
); } export default function App() { return (