Architecture
Papyrus is split into small layers so UI and engine can evolve independently.
Packages
| Package | Role |
|---|---|
@papyrus-sdk/types | Shared contracts (DocumentEngine, Annotation, events). |
@papyrus-sdk/core | Store + events (useViewerStore, papyrusEvents). |
@papyrus-sdk/engine-pdfjs | Web engine adapter on top of PDF.js. |
@papyrus-sdk/ui-react | Web UI for reader, search, and navigation. |
@papyrus-sdk/engine-native | iOS/Android bridge (PDFKit, PDFium). |
@papyrus-sdk/ui-react-native | Mobile UI with sheets and toolbars. |
Data flow
- Engine loads the document and exposes page count, outline, text.
- UI components call engine methods and update store state.
papyrusEventsemits lifecycle and annotation events for your app.
Engine agnostic
UI components never import PDF.js or native code directly. They talk to the DocumentEngine interface so you can swap engines without changing UI logic.