react-pdf-kit-nextjs-app-router — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited react-pdf-kit-nextjs-app-router (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Use this skill when: the developer asks to add a PDF viewer using @react-pdf-kit/viewer to a Next.js App Router project (app/ directory) on Next.js 15+ (with Turbopack). For Pages Router use react-pdf-kit-nextjs-pages-router. Next.js 14 is not supported by v2 — see react-pdf-kit-nextjs14-pdfjs-override.
The viewer is client-only: it relies on browser APIs and cannot run on the server. The skill structures the integration around that constraint.
Server Component (or letting Next SSR it) throws TypeError: Promise.withResolve is not a function. Every component that imports from @react-pdf-kit/viewer needs 'use client', AND must be mounted through a next/dynamic import with ssr: false.
@react-pdf-kit/viewer. Do NOT install pdfjs-distseparately.** It is an auto-installed peer dependency. No worker configuration is required either — RPConfig handles it. Custom worker URLs / version overrides live in react-pdf-kit-worker-config.
license and config apply app-wide. The page-level viewer mounts the RPProvider / RPLayout / RPPages chain.
next dev --turbopack) for thesmoothest experience. Next.js 14 + webpack is unsupported by v2.
layout doesn't shift. Without a definite height the virtualizer can mount with 0 rows.
RPLayout.pnpm add @react-pdf-kit/viewerRPConfig at the root layout (client-only)// app/components/AppProviders.tsx
'use client'
import { RPConfig, type RPConfigProps } from '@react-pdf-kit/viewer'
import { type PropsWithChildren } from 'react'
export default function AppProviders({
children,
...props
}: PropsWithChildren<RPConfigProps>) {
return <RPConfig {...props}>{children}</RPConfig>
}// app/components/LazyAppProviders.tsx
'use client'
import dynamic from 'next/dynamic'
const LazyAppProviders = dynamic(() => import('./AppProviders'), {
ssr: false,
})
export default LazyAppProviders// app/layout.tsx
import { type PropsWithChildren } from 'react'
import LazyAppProviders from './components/LazyAppProviders'
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html lang="en">
<body>
<LazyAppProviders licenseKey="your-license-key">
<main>{children}</main>
</LazyAppProviders>
</body>
</html>
)
}licenseKey is optional; without it the viewer runs in trial mode (watermark).
// app/components/AppPdfViewer.tsx
'use client'
import { RPProvider, RPLayout, RPPages } from '@react-pdf-kit/viewer'
export default function AppPdfViewer({ pdfSrc }: { pdfSrc: string }) {
return (
<RPProvider src={pdfSrc}>
<RPLayout toolbar>
<RPPages />
</RPLayout>
</RPProvider>
)
}// app/components/LazyAppPdfViewer.tsx
'use client'
import dynamic from 'next/dynamic'
const LazyAppPdfViewer = dynamic(() => import('./AppPdfViewer'), {
ssr: false,
})
export default LazyAppPdfViewer// app/document/[id]/page.tsx
import LazyAppPdfViewer from '../../components/LazyAppPdfViewer'
export default function DocumentPage({ params }: { params: { id: string } }) {
return (
<main style={{ height: '100vh' }}>
<LazyAppPdfViewer pdfSrc={`/api/documents/${params.id}.pdf`} />
</main>
)
}pnpm install
pnpm build
pnpm dev --turbopack # then visit /document/<id>Open the page. The first PDF page should render with the default toolbar. Scroll to confirm virtualization, and select text on a rendered page to confirm the text layer mounted. There should be no Promise.withResolve is not a function error in the console.
react-pdf-kit-nextjs14-pdfjs-override: read this if the projectis on Next.js 14 (v2 is unsupported there).
react-pdf-kit-worker-config: for overriding pdfjs-dist and theNext.js 15 / Turbopack workerUrl recipe.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.