Migration from @react-pdf-viewer

Moving from @react-pdf-viewer? Start with the native API, or use the compatibility entry for incremental migration.

Recommended: native API

Replace the old viewer with DocumentViewer:

tsx
// Before
import { Worker, Viewer } from "@react-pdf-viewer/core";
import "@react-pdf-viewer/core/lib/styles/index.css";

// After
import { DocumentViewer } from "lumipdf";
import "lumipdf/styles";

<DocumentViewer source={{ kind: "url", url: fileUrl }} />

Compatibility layer

A thin compatibility surface lives at lumipdf/compat/react-pdf-viewer (when using the package exports available in your build). Prefer the native DocumentViewer for new code - it exposes the full feature set and types.

Checklist

  1. Install lumipdf and remove @react-pdf-viewer/* packages when ready
  2. Swap stylesheets to lumipdf/styles
  3. Map fileUrl / fileUrlString to FileSource
  4. Re-test search, zoom, and print shortcuts in your app shell

Differences

  • Plugin architecture differs - use props, callbacks, and the ref API instead of plugin packages
  • Annotation model is first-class with serialize/parse helpers
  • Themes use a single theme prop rather than nested theme objects