import { Viewer, DocumentGate, saveFile, 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 { SelectionLayer, selectionPlugin } from '@embedpdf/react/selection'; import { interactionPlugin, useInteraction, useInteractionState, } from '@embedpdf/react/interaction'; import { AnnotationLayer, annotationPlugin } from '@embedpdf/react/annotation'; import { localEngine } from '@embedpdf/engine'; import './download.css'; const engine = localEngine(); const plugins = [ stagePlugin(), renderPlugin(), interactionPlugin(), selectionPlugin(), annotationPlugin(), ]; // [!doc-source report] const report = async (): Promise => { const response = await fetch('https://www.embedpdf.com/pdfs/report.pdf'); return { kind: 'bytes', id: 'report', bytes: new Uint8Array(await response.arrayBuffer()) }; }; // [!/doc-source] // The annotations are part of the document: the downloaded PDF has every one. function SaveBar() { const documents = useDocuments(); const interaction = useInteraction(); const { activeToolId } = useInteractionState(); const { hasUnsavedChanges } = useDocument(); return (
{hasUnsavedChanges ? 'Unsaved changes' : 'All saved'}
); } export default function App() { return ( Loading…

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