import { useState } from 'react'; import { Viewer, DocumentGate, usePageList } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { PageView } from '@embedpdf/react/page-view'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { cloudEngine } from '@cloudpdf/engine'; import './basic.css'; const engine = cloudEngine(); // No Stage: a page on its own needs only the render plugin. const plugins = [renderPlugin()]; const welcome: OpenInput = { kind: 'grant', grant: 'shr_gvpJcG1ULUMon19C0D1wODSY' }; // A card that shows one page, like a preview next to a search result or a comment. function PageCard() { const pages = usePageList(); const [index, setIndex] = useState(0); const page = pages[index]; return (
Page {page?.label ?? index + 1} {page ? ( {Math.round(page.size.width)} × {Math.round(page.size.height)} points ) : null}
); } export default function App() { return ( Loading…

}>
); }