TeamSync-PDF-Viewer README

The project's README from github.com/angelbot-ai/TeamSync-PDF-Viewer. As one markdown file: README.md.

TeamSync PDF Viewer SDK

TeamSync PDF Viewer UI

100% Open Source. 100% Client-Side. Enterprise SDK.

License: CPAL-1.0 Live Demo NPM Version React 19 Vite 8 TypeScript

No paywalls. No vendor lock-in. No server dependencies.
Try the Interactive Live Demo or integrate the high-performance PDF Viewer SDK directly into your React applications.


🚀 Why TeamSync PDF Viewer?

Traditional commercial PDF viewers force developers into expensive per-domain licenses, opaque sales calls, and heavy server-side processing dependencies. TeamSync PDF Viewer is built from the ground up to solve these pain points.


📦 Installation via NPM

Install the package into your React / TypeScript project:

# Using npm
npm install teamsync-pdf-viewer

# Using yarn
yarn add teamsync-pdf-viewer

# Using pnpm
pnpm add teamsync-pdf-viewer

Installing from GitHub Packages (Alternative)

If installing from GitHub Packages registry:

  1. Create or update your .npmrc file:
    @angelbot-ai:registry=https://npm.pkg.github.com
    
  2. Install via npm:
    npm install teamsync-pdf-viewer
    

📖 Official Documentation & Wiki

Explore detailed SDK guides, parameter options, code snippets, and architecture deep dives:


✨ Uncompromised Feature Set

Everything you need to build collaborative, secure document workflows.

🎨 Smart Markup & Annotations

🛡️ Secure Redaction

📐 Dynamic Layout & Viewport Controls

💧 Dynamic Forensic Watermarking


💻 Developer SDK Usage

Standard WebViewer Initialization

Drop the SDK into any container element with a single function call:

import { WebViewer } from 'teamsync-pdf-viewer';
import 'teamsync-pdf-viewer/style.css';

WebViewer({
  initialDoc: '/sample.pdf',
  initialScale: 1.0, // 100% natural size
  enableAnnotations: true,
  permissions: {
    canRedact: true,
    canAddAnnotations: true
  },
  watermark: {
    text: 'CONFIDENTIAL',
    mode: 'single',
    size: 48,
    opacity: 0.1,
    color: '#dc2626'
  }
}, document.getElementById('viewer-container')).then((instance) => {
  console.log('TeamSync PDF Viewer is ready!', instance);
  
  // Programmatic Viewport Controls
  instance.UI.fitWidth();
  instance.UI.fitPage();

  // Export annotated PDF buffer
  instance.Core.documentViewer.getDocument().getFileData().then((pdfBytes) => {
    console.log('Exported PDF byte length:', pdfBytes.length);
  });
});

Native React Component Usage

For native React integration, use the <DocumentViewer /> component:

import { DocumentViewer } from 'teamsync-pdf-viewer';
import 'teamsync-pdf-viewer/style.css';

function App() {
  return (
    <div style={{ width: '100vw', height: '100vh' }}>
      <DocumentViewer
        initialDoc="/contract.pdf"
        scale={1.0}
        enableAnnotations={true}
        permissions={{ canRedact: true, canAddAnnotations: true }}
      />
    </div>
  );
}

🛠️ Local Development Quick Start

1. Clone & Install

git clone https://github.com/angelbot-ai/TeamSync-PDF-Viewer.git
cd TeamSync-PDF-Viewer
npm install

2. Launch Dev Server

npm run dev

Open http://localhost:5173 in your browser to launch the live SDK viewer.


🔌 Extensible Plugin Architecture

TeamSync PDF Viewer features a decoupled Plugin Architecture. Core PDF rendering, smart annotations, redaction engines, and search remain lightweight and modular in the main engine, while enterprise extensions plug in as independent modules.

┌─────────────────────────────────────────────────────────┐
│              TeamSync PDF Viewer Core                   │
│   (Page Rendering, Annotations, Redactions, Search)     │
└───────────────────────────┬─────────────────────────────┘
                            │ Plugins Registry API
┌───────────────────────────▼─────────────────────────────┐
│                   Custom Extension                      │
│      (Custom Modals, Action Buttons, Export Hooks)      │
└─────────────────────────────────────────────────────────┘
import { WebViewer } from 'teamsync-pdf-viewer';
import { myCustomPlugin } from './myCustomPlugin';

WebViewer({
  initialDoc: '/sample.pdf',
  plugins: [
    myCustomPlugin({ enableFeature: true })
  ]
}, document.getElementById('viewer-container'));

🏛️ Architecture & Tech Stack

TeamSync-PDF-Viewer/
├── src/
│   ├── components/       # Native React UI (Header, DocumentViewer, Sidebars, Modals)
│   ├── hooks/            # Search & Keyboard shortcut hooks
│   ├── utils/            # Redaction algorithms, rotation transforms & vector helpers
│   ├── plugins/          # Plugin API interfaces & registry
│   ├── index.ts          # Main SDK package exports
│   ├── main.tsx          # WebViewer SDK entry point & public API bridge
│   └── App.tsx           # Demo Application Shell
├── public/               # Static PDF assets & PDF.js workers
└── docs/images/          # High-res UI documentation screenshots

📄 License

Distributed under the CPAL 1.0 (Common Public Attribution License).
100% Free and Open Source for personal and commercial usage.


AngelBot AI • TeamSync • https://www.teamsync.com
TeamSync PDF Viewer Engine • Engineered with ❤️ for the Open Web.

TeamSync-PDF-Viewer (angelbot-ai/TeamSync-PDF-Viewer)

Searching Database…

这是什么?TeamSync PDF Viewer 是一个开源、100% 客户端的 React 应用 PDF 查看器 SDK,具备批注、安全脱敏、取证水印和搜索功能,基于 WebAssembly(PDF.js + pdf-lib)构建。
它是独立应用,还是嵌入我自己项目里的东西?它是一个无界面的 SDK/组件,需要通过 WebViewer({...}) API 调用或原生 React 组件嵌入 React/TypeScript 应用——不是独立的 PDF 阅读器应用。
怎么把它加进我的 React 项目?从 npm 把软件包安装到你的 React/TypeScript 项目(或用 .npmrc 文件从 GitHub Packages 安装),然后用 WebViewer({...}) 调用初始化,或直接放入原生 React 组件。
它需要后端服务器或 API 密钥吗?不需要——它完全在客户端运行,在浏览器沙箱内通过 WebAssembly(PDF.js + pdf-lib)处理,不依赖任何服务端处理。
它在任何 React 环境下都能用吗?它专门为现代 React 19 SPA 生命周期构建,并有意避开 iframe 以获得完整的样式控制权,因此较旧的 React 版本或基于 iframe 的嵌入可能无法直接适配。
使用它时,我的 PDF 文档会去哪里?文档完全在浏览器内通过 WebAssembly 处理,永远不会离开浏览器沙箱——没有任何上传服务器的环节。
它的许可证有 MIT 那么宽松吗?它使用 CPAL 1.0(Common Public Attribution License),而不是普通的 MIT/Apache 许可证,但个人和商业使用都免费,没有按域名收费。
开箱自带哪些批注工具?手绘墨迹/画笔、荧光笔、几何图形、箭头和线条、便签、标注文本框,以及可点击的内部页跳转或外部超链接。
脱敏做得有多彻底?脱敏内容会被永久栅格化写入 PDF 的矢量结构,被遮盖的文本会从 DOM 文本层和内容流中移除,因此无法复制粘贴或搜索;它还支持基于正则的 PII 自动脱敏。
它能给文档加水印吗?可以。它支持动态取证水印,可实时渲染为居中单枚水印或整页平铺,文本、颜色、透明度、大小和旋转角度均可自定义。
我能用自定义功能扩展它吗?可以。它采用解耦的插件架构——核心渲染、批注、脱敏和搜索引擎保持轻量,企业级扩展以独立模块接入。
Size
6.8 MB
Stars
245
Age
2mo
Commits · 90 Days