import { Viewer, DocumentGate } from '@embedpdf/react/runtime'; import type { OpenInput } from '@embedpdf/react/runtime'; import { Stage, stagePlugin, useStage, useStageSettings } from '@embedpdf/react/stage'; import type { StageSettings } from '@embedpdf/react/stage'; import { RenderLayer, renderPlugin } from '@embedpdf/react/render'; import { localEngine } from '@embedpdf/engine'; import './presets.css'; const engine = localEngine(); // Zoomed in, so a page is wider than the view and you can see where it lands. const plugins = [stagePlugin({ zoom: { level: 1.6 } }), renderPlugin()]; // A preset is an object you keep, and apply with updateSettings(). const READING: Partial = { arrivalAlign: { x: 'start', y: 'start' }, zoomAlign: { x: 'center', y: 'center' }, anchorAlign: { x: 'start', y: 'start' }, }; const PRESENTATION: Partial = { arrivalAlign: { x: 'center', y: 'center' }, zoomAlign: { x: 'center', y: 'center' }, anchorAlign: { x: 'center', y: 'center' }, }; const welcome = async (): Promise => { const response = await fetch('https://www.embedpdf.com/pdfs/welcome.pdf'); return { kind: 'bytes', id: 'welcome', bytes: new Uint8Array(await response.arrayBuffer()) }; }; function FeelSwitcher() { const stage = useStage(); // The settings say which feel is on: pages land centered in a presentation. const presentation = useStageSettings((settings) => settings.arrivalAlign.y === 'center'); return (
); } export default function App() { return ( Loading…

}> {() => }
); }