登录 注册
效率与办公工具 pdfpdf-viewerreact
11,200
Stars
1,004
Forks
57
Watchers
15
Open Issues
MIT
许可证
TypeScript
语言
2016-08-01
创建时间
2026-10-28
最近更新

项目能做什么

让 React 应用能像展示图片一样轻松预览和渲染 PDF 的组件库。
来源:AI 基于仓库事实生成 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
[![npm](https://img.shields.io/npm/v/react-pdf.svg)](https://www.npmjs.com/package/react-pdf) ![downloads](https://img.shields.io/npm/dt/react-pdf.svg) [![CI](https://github.com/wojtekmaj/react-pdf/actions/workflows/ci.yml/badge.svg)](https://github.com/wojtekmaj/react-pdf/actions)

# React-PDF

Display PDFs in your React app as easily as if they were images.

## Lost?

This package is used to _display_ existing PDFs. If you wish to _create_ PDFs using React, you may be looking for [@react-pdf/renderer](https://www.npmjs.com/package/@react-pdf/renderer).

## tl;dr

- Install by executing `npm install react-pdf` or `yarn add react-pdf`.
- Import by adding `import { Document } from 'react-pdf'`.
- Wrap the viewer in React `Suspense` and an Error Boundary, then add `<Document file="..." />`. `file` can be a URL, base64 content, Uint8Array, and more.
- Put `<Page />` components inside `<Document />` to render pages.
- Import stylesheets for [annotations](#support-for-annotations) and [text layer](#support-for-text-layer) if applicable.

## Demo

A minimal demo page can be found in `sample` directory.

[Online demo](https://projects.wojtekmaj.pl/react-pdf/) is also available!

## Before you continue

React-PDF is under constant development. This documentation is written for React-PDF 11.x branch. If you want to see documentation for other versions of React-PDF, use dropdown on top of GitHub page to switch to an appropriate tag. Here are quick links to the newest docs from each branch:

- [v10.x](https://github.com/wojtekmaj/react-pdf/blob/v10.x/packages/react-pdf/README.md)
- [v9.x](https://github.com/wojtekmaj/react-pdf/blob/v9.x/packages/react-pdf/README.md)
- [v8.x](https://github.com/wojtekmaj/react-pdf/blob/v8.x/packages/react-pdf/README.md)
- [v7.x](https://github.com/wojtekmaj/react-pdf/blob/v7.x/packages/react-pdf/README.md)
- [v6.x](https://github.com/wojtekmaj/react-pdf/blob/v6.x/README.md)
- [v5.x](https://github.com/wojtekmaj/react-pdf/blob/v5.x/README.md)

## Getting started

### Compatibility

#### Browser support

React-PDF supports the latest versions of all major modern browsers.

Minimum browser requirements are Chrome 125 and Safari 18 (iOS 18). Versions below the latest releases, but meeting these minimums, may require additional polyfills, bundler transpilation, and the [legacy PDF.js worker](#legacy-pdfjs-worker).

For example, Chrome 125 requires a polyfill for `URL.parse()`, which is used by PDF.js. Load the polyfill before initializing React-PDF:

```javascript
if (typeof URL !== 'undefined' && typeof URL.parse !== 'function') {
  URL.parse = function (url, base) {
    try {
      return new URL(url, base);
    } catch {
      return null;
    }
  };
}
```

Polyfilling this API alone does not establish compatibility with browsers below the minimum requirements.

For details, see the [PDF.js browser compatibility documentation](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support).

#### React

To use t
阅读完整原文

商业机会分析 AI 生成

商业级 React PDF UI 组件库与增强套件 (React-PDF Pro)

产品构想基于 react-pdf 构建一套无头 (Headless) 或开箱即用 Tailwind 风格的高级 UI 组件库,补齐官方缺失的侧边栏缩略图、目录树、双页/连续虚拟滚动、文本搜索高亮与工具栏组件。
核心功能开箱即用响应式工具栏、缩略图导航抽屉、多页虚拟滚动(react-window 集成)、高亮搜索、主题定制系统。
目标用户不想从零实现 viewer 交互的独立开发者、企业中后台研发团队。
难度/周期中等 · 1 - 2 个月 · 成本:开发机器与静态演示站点托管成本,几乎为零额外外部成本。
收费模式双许可协议(开源核心 + 商业 Pro 功能源码授权);单开发者/团队终身买断制或年费订阅(类 Shadcn UI Pro / Tailwind UI 模式)。
竞争风险市面上存在其他集成型开源查看器(如 pdf.js 自带 viewer 的封装库),需在 UI 现代感与 React 19 专属适配体验上形成明显代差。
依据 数据支持的判断

轻量级 PDF 批注与电子签名商业 SDK

产品构想在 react-pdf 渲染层之上构建批注图层引擎,支持高亮、涂鸦、图章、电子签名与文本注释,并支持将批注层回写/导出为标准 PDF 格式。
核心功能交互式批注工具(手写签名、文本框、矢量划线)、批注 JSON 数据导入导出、PDF 批注合流导出(推测需结合 pdf-lib)。
目标用户OA 审批、法律合同系统、在线教育批改系统的 SaaS 厂商。
难度/周期较高 · 2 - 3 个月 · 成本:开发与跨端(移动端触控/手势)适配测试成本。
收费模式商业闭源 SDK 授权,按域名或应用实例收费(提供远低于 PSPDFKit/PDFTron 的平替价格)。
竞争风险PDF 规范中注释图层与回写逻辑复杂,若遇到冷门 PDF 标准可能出现渲染变形或导出失败。
依据 尚需验证的假设

文档安全与合规查看器组件 (React Secure PDF)

产品构想针对敏感文件外发的安全合规需求,提供防截图动态水印(工号/时间戳)、禁止右键/文本选中导出、阅读时长与翻页埋点追踪的企业级查看组件。
核心功能动态防篡改 canvas 水印注入、禁止下载/打印拦截、分页阅读停留热力图埋点、Canvas/SVG 渲染防抓包保护。
目标用户金融、政企合规、在线付费电子书/课件平台的研发负责人。
难度/周期中等 · 3 - 5 周 · 成本:极低,纯前端逻辑封装。
收费模式企业级源码买断授权,定制防泄密功能二次开发咨询服务。
竞争风险纯前端防截图与防盗取存在天然技术上限,需明确告知客户安全边界。
依据 AI推测
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
microsoft/markitdown 中文介绍暂未生成
Python tool for converting files and office documents to Mar
194,935 Python
Graphify-Labs/graphify 中文介绍暂未生成
Turn any codebase, with its docs, SQL schemas, configs, and
146,070 Python
justjavac/free-programming-books-zh_CN 中文介绍暂未生成
:books: 免费的计算机编程类中文书籍,欢迎投稿
119,575 -
Stirling-Tools/Stirling-PDF 中文介绍暂未生成
#1 PDF Application on GitHub that lets you edit PDFs on any
96,304 TypeScript
PaddlePaddle/PaddleOCR 中文介绍暂未生成
Turn any PDF or image document into structured data for your
92,584 Python
fighting41love/funNLP 中文介绍暂未生成
中英文敏感词、语言检测、中外手机/电话归属地/运营商查询、名字推断性别、手机号抽取、身份证抽取、邮箱抽取、中日文人名库、
84,528 Python
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建于 2016-08-01,近 30 天仍在推送,发布过 100 个 Release
社区活跃Star 11,200 / Fork 1,004 / Issue 15(数据支持,可自行核实)
许可证MIT
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

快速开始(以仓库 README 为准)
git clone https://github.com/wojtekmaj/react-pdf.git
cd react-pdf
# 请阅读仓库 README 获取确切安装步骤(依赖、配置、启动命令)
阅读原仓库文档
术语说明:Docker=应用容器(把程序和依赖打包运行);API Key=调用外部服务的密钥;Git Clone=把仓库代码下载到本地。常见错误:API Key 未配置 / 端口占用 / 数据库连接失败,多数项目在 README 的 Troubleshooting 章节有说明。