@pdfrx/colab
v0.27.0
Published
Collaborative React PDF viewer components and session protocol for pdfrx
Maintainers
Readme
@pdfrx/colab
Collaborative PDF editing for @pdfrx/react. It provides a ready-made React
viewer plus the browser client, operation protocols, page-source adapter, and
mixed-source export tools needed to synchronize page, annotation, and form
changes through an application-hosted relay.
npm package · Local example · API reference · Detailed guide
Highlights
- Synchronizes page insertion, removal, movement, duplication, and rotation; annotations; and AcroForm values.
- Ordered, revision-checked semantic operations keep WebSocket traffic small and provide authoritative late-join snapshots.
- Page, annotation, and form changes use independent revision streams so one kind of edit does not block the others.
- Transient move/resize previews appear remotely without entering persistent snapshots, PDF state, or Undo/Redo history.
- Stable page-placement and source IDs support documents assembled from multiple immutable PDFs and images.
- The ready-made React viewer retains the standard
@pdfrx/reacttoolbar, responsive layout, editing tools, and export UI. - Lower-level clients, reducers, source adapters, and mixed-source PDF export are available for custom applications and relay implementations.
- Authentication, persistence, admission, retention, and deployment remain explicit application responsibilities rather than hidden hosted services.
Install
npm install @pdfrx/colab @pdfrx/react react react-domMinimal usage
import { CollaborativePdfViewer } from '@pdfrx/colab';
import '@pdfrx/react/styles.css';
import '@pdfrx/colab/styles.css';
export function ReviewRoom() {
return (
<CollaborativePdfViewer
actorId="user-42"
relayUrl="wss://relay.example.com/collaboration"
sessionId="review-123"
src="/documents/review.pdf"
wasmModulesUrl="/pdfium/"
className="review-room"
/>
);
}.review-room {
height: 100dvh;
min-height: 0;
}Required relay
relayUrl must be an application-hosted WebSocket service implementing the
exported collaboration protocol. This package does not include or operate a
hosted production service. The relay must sequence revision-checked page,
annotation, and form operations and expose immutable PDF/raster source
PUT/GET endpoints.
Run npm run dev:colab in this repository to start the example application and
reference relay for local development.
Next steps
- The Colab guide covers authentication hooks, synchronized state, lower-level clients, adapters, export, conflicts, and production responsibilities.
- The wire protocol specification is the authoritative relay contract.
CollaborativePdfViewerPropsdocuments all component inputs.- The collaboration example documents local relay configuration, persistence, and deployment boundaries.
- Related packages:
@pdfrx/engine·@pdfrx/viewer·@pdfrx/react
License
MIT
