npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@doc-preview/react

v1.1.2

Published

React wrapper for Doc Preview.

Downloads

311

Readme

@doc-preview/react

React component for multi-format document preview, built on @doc-preview/core. Same viewer as Angular and vanilla JS — PDF, DOCX, images, optional Office pack, and Enterprise annotations, watermark, split view, print, search, redaction, and diff.

Current release: 1.1.2 — Depends on @doc-preview/core ^1.1.2. See monorepo CHANGELOG.

Repository & docs: github.com/rajkishorsahu89/doc-preview

Demo: doc-preview-app.vercel.apptool · demo · guide

Ships as ESM with TypeScript declarations. Works with React 18 and 19. Import @doc-preview/themes CSS once in your app.

Keywords: doc-preview react document-viewer pdf docx file-preview annotations

Install

npm install @doc-preview/react @doc-preview/themes
# Adds @doc-preview/core automatically.
# Peer deps: react ^18 || ^19, react-dom ^18 || ^19.
# Optional:
npm install @doc-preview/enterprise @doc-preview/office

Supported file types

Same engine as Angular — install @doc-preview/office and call registerOfficePreviewRenderers() for spreadsheet, deck, legacy Office, and cloud URL formats.

| Category | Extensions | Package | | --- | --- | --- | | PDF | .pdf | core | | Images | .png, .jpg, .jpeg, .gif, .webp, .bmp, .svg, .tif, .tiff | core | | Word | .docx, .docm, .dotx | core | | Word (legacy) | .doc | office | | Excel | .xlsx, .xlsm, .xltx, .xls, .ods | office | | PowerPoint | .pptx, .pptm, .potx, .ppt, .odp | office | | OpenDocument text | .odt | office | | CSV / TSV | .csv, .tsv | core | | Text & data | .txt, .md, .log, .json, .xml | core | | HTML | .html, .htm | core | | Video / audio | .mp4, .webm, .mov, .mp3, .wav, .m4a | core | | Cloud embed (public URL) | .doc, .ppt, .pptx, .xlsx, .pdf, .odt, .ods, .odp | office |

Upload accept: .pdf,.doc,.docx,.docm,.dotx,.odt,.ods,.odp,.xls,.xlsx,.xlsm,.xltx,.ppt,.pptx,.pptm,.potx,.png,.jpg,.jpeg,.gif,.webp,.bmp,.svg,.tif,.tiff,.mp4,.webm,.mov,.mp3,.wav,.m4a,.txt,.md,.html,.htm,.csv,.tsv,.json,.xml,.log

Usage — component

import { DocPreview } from "@doc-preview/react";
import "@doc-preview/themes/doc-preview.css";

export function Viewer() {
  return (
    <DocPreview
      documents={[{ uri: "/sample.pdf", fileName: "sample.pdf" }]}
      onPhaseChange={(e) => console.log(e.phase)}
    />
  );
}

Usage — upload & Blob

import { DocPreview } from "@doc-preview/react";
import { createPreviewDocumentsFromFiles } from "@doc-preview/core";

<DocPreview
  documents={docs}
  config={{ upload: { enabled: true, accept: ".pdf,.png,.docx" } }}
  onFilesSelected={(files) => setDocs(createPreviewDocumentsFromFiles(files))}
/>

Usage — Enterprise

<DocPreview
  documents={docs}
  enterpriseLicenseKey="DP-ENT-DEMO-0001-ANNOTATIONS-SPLIT"
  config={{
    enterprise: {
      watermarkText: "CONFIDENTIAL",
      enableAnnotations: true,
      enablePrint: true,
      splitView: true
    }
  }}
  onEnterpriseStatusChange={(licensed) => console.log(licensed)}
/>

Usage — Office pack

import { registerBuiltinPreviewRenderers } from "@doc-preview/core";
import { registerOfficePreviewRenderers } from "@doc-preview/office";

registerBuiltinPreviewRenderers();
registerOfficePreviewRenderers();

API — DocPreview props

Extends PreviewHostOptions from core plus:

| Prop | Type | Description | | --- | --- | --- | | documents | PreviewDocument[] | Required. | | config | PreviewConfig | Upload, PDF, enterprise, office options. | | enterpriseLicenseKey | string | Enterprise licence key. | | dark | boolean | Dark theme. | | theme | PreviewThemeTokens | CSS token overrides. | | slots | PreviewSlots | Header slot overrides. | | className / style | — | Host wrapper styling. | | onPhaseChange | (event) => void | Loading / error phases. | | onDocumentChange | (doc, index) => void | Active document changed. | | onFilesSelected | (files) => void | Built-in upload picker. | | onEnterpriseStatusChange | (licensed) => void | Licence status. |

Re-exports all public symbols from @doc-preview/core.

React vs Angular naming

| React | Angular | | --- | --- | | <DocPreview /> | <doc-preview> | | onPhaseChange | (phaseChange) | | onFilesSelected | (filesSelected) |

Related packages

License

MIT