teamsync-pdf-viewer 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,77 @@
1
+ Common Public Attribution License Version 1.0 (CPAL)
2
+
3
+ 1. “Definitions”
4
+
5
+ 1.0.1 “Commercial Use” means distribution or otherwise making the Covered Code available to a third party.
6
+
7
+ 1.1 “Contributor” means each entity that creates or contributes to the creation of Modifications.
8
+
9
+ 1.2 “Contributor Version” means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
10
+
11
+ 1.3 “Covered Code” means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
12
+
13
+ 1.4 “Electronic Distribution Mechanism” means a mechanism generally accepted in the software development community for the electronic transfer of data.
14
+
15
+ 1.5 “Executable” means Covered Code in any form other than Source Code.
16
+
17
+ 1.6 “Initial Developer” means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A.
18
+
19
+ 1.7 “Larger Work” means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
20
+
21
+ 1.8 “License” means this document.
22
+
23
+ 1.8.1 “Licensable” means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
24
+
25
+ 1.9 “Modifications” means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
26
+
27
+ A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
28
+
29
+ B. Any new file that contains any part of the Original Code or previous Modifications.
30
+
31
+ 1.10 “Original Code” means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
32
+
33
+ 1.10.1 “Patent Claims” means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
34
+
35
+ 1.11 “Source Code” means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor’s choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
36
+
37
+ 1.12 “You” (or “Your”) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, “You” includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
38
+
39
+ 2. Source Code License.
40
+
41
+ 2.1 The Initial Developer Grant.
42
+ The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
43
+
44
+ (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
45
+
46
+ (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
47
+
48
+ (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
49
+
50
+ (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
51
+
52
+ 2.2 Contributor Grant.
53
+ Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
54
+
55
+ (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
56
+
57
+ (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
58
+
59
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code.
60
+
61
+ (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
62
+
63
+ 3. Distribution Obligations.
64
+
65
+ 3.1 Application of License.
66
+ The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients’ rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5.
67
+
68
+ 3.2 Availability of Source Code.
69
+ Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
70
+
71
+ 3.3 Description of Modifications.
72
+ You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
73
+
74
+ 3.4 Intellectual Property Matters
75
+
76
+ (a) Third Party Claims. If Contributor has knowledge that a license under a third party’s intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled “LEGAL” which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modificati
77
+
package/README.md ADDED
@@ -0,0 +1,233 @@
1
+ # TeamSync PDF Viewer SDK
2
+
3
+ <div align="center">
4
+
5
+ ![TeamSync PDF Viewer UI](https://raw.githubusercontent.com/angelbot-ai/TeamSync-PDF-Viewer/main/docs/images/viewer_ui.png)
6
+
7
+ ### **100% Open Source. 100% Client-Side. Enterprise PDF Engine.**
8
+
9
+ [![License: CPAL-1.0](https://img.shields.io/badge/License-CPAL--1.0-blue.svg)](LICENSE)
10
+ [![Live Demo](https://img.shields.io/badge/Live%20Demo-pdfviewer.teamsync.com-000000.svg)](https://pdfviewer.teamsync.com/)
11
+ [![NPM Version](https://img.shields.io/badge/npm-%40angelbot--ai%2Fteamsync--pdf--viewer-blue.svg)](https://www.npmjs.com/package/teamsync-pdf-viewer)
12
+ [![React 19](https://img.shields.io/badge/React-19-61dafb.svg)](https://reactjs.org/)
13
+ [![Vite 8](https://img.shields.io/badge/Vite-8.2-646cff.svg)](https://vitejs.dev/)
14
+ [![TypeScript](https://img.shields.io/badge/TypeScript-6.0-blue.svg)](https://www.typescriptlang.org/)
15
+
16
+ *No paywalls. No vendor lock-in. No server dependencies.*
17
+ Try the **[Interactive Live Demo](https://pdfviewer.teamsync.com/)** or integrate the high-performance PDF Viewer SDK into your React applications.
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## 🚀 Why TeamSync PDF Viewer?
24
+
25
+ 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.
26
+
27
+ - 💰 **Zero-Cost, Transparent Licensing**: Uncapped usage, no per-server fees, and no commercial paywalls. 100% free and open-source under CPAL 1.0.
28
+ - ⚡ **100% Client-Side WebAssembly**: Documents never leave the browser sandbox. Process, redact, and render PDFs entirely on the client—guaranteeing instant **HIPAA**, **GDPR**, and **FINRA** compliance.
29
+ - 🔌 **Universal WebViewer API**: Clean, intuitive `WebViewer({...})` API interface that makes integrating into your web applications effortless.
30
+ - 🎨 **Headless & Customizable**: Built for modern React 19 SPA lifecycles. No bloated iFrames to fight—customize toolbars, sidebars, context menus, and controls natively.
31
+
32
+ ---
33
+
34
+ ## 📦 Installation via NPM
35
+
36
+ Install the package into your React / TypeScript project:
37
+
38
+ ```bash
39
+ # Using npm
40
+ npm install teamsync-pdf-viewer
41
+
42
+ # Using yarn
43
+ yarn add teamsync-pdf-viewer
44
+
45
+ # Using pnpm
46
+ pnpm add teamsync-pdf-viewer
47
+ ```
48
+
49
+ ### Installing from GitHub Packages (Alternative)
50
+
51
+ If installing from GitHub Packages registry:
52
+
53
+ 1. Create or update your `.npmrc` file:
54
+ ```ini
55
+ @angelbot-ai:registry=https://npm.pkg.github.com
56
+ ```
57
+ 2. Install via npm:
58
+ ```bash
59
+ npm install teamsync-pdf-viewer
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 📖 Official Documentation & Wiki
65
+
66
+ Explore detailed SDK guides, parameter options, code snippets, and architecture deep dives:
67
+
68
+ - 🏠 **[Wiki Home](docs/wiki/Home.md)**: Main documentation index & overview.
69
+ - 🚀 **[Getting Started Guide](docs/wiki/Getting-Started.md)**: Installation, CDN, and framework setups.
70
+ - ⚙️ **[API Reference & Options](docs/wiki/API-Reference-&-Options.md)**: Complete parameter list for `WebViewerOptions` & `SDKPermissions`.
71
+ - 🎨 **[Annotations & Markup Guide](docs/wiki/Annotations-&-Markup-Guide.md)**: Freehand drawing, vector shapes, callouts & links.
72
+ - 🛡️ **[Redactions & PII Sanitization Guide](docs/wiki/Redactions-&-PII-Sanitization.md)**: Binary redactions, regex PII scanning & discard options.
73
+ - 💧 **[Forensic Watermarking Guide](docs/wiki/Forensic-Watermarking.md)**: Dynamic single and tiled watermark setup.
74
+ - 🔌 **[Plugin Architecture Guide](docs/wiki/Plugin-Architecture.md)**: Writing custom extension plugins.
75
+
76
+ ---
77
+
78
+ ## ✨ Uncompromised Feature Set
79
+
80
+ Everything you need to build collaborative, secure document workflows.
81
+
82
+ ### 🎨 Smart Markup & Annotations
83
+ - **Full Drawing Toolkit**: Freehand ink (`brush`), highlighters, geometric shapes (rectangles, ellipses), arrows, and lines.
84
+ - **Notes & Callouts**: Sticky notes, callout text boxes with directional arrows, and text annotations.
85
+ - **Interactive Hyperlinks**: Create internal page-jump links (`#page=N`) or external web URL links directly on document selections.
86
+
87
+ ### 🛡️ Military-Grade Secure Redaction
88
+ - **Binary-Level Data Obliteration**: We don't just place black boxes over text—redactions are permanently rasterized and burned into the underlying PDF vector structure.
89
+ - **Text Layer Sanitization**: Redacted text is automatically stripped from the DOM `textLayer` and PDF content streams, preventing copy/paste extraction and search indexing.
90
+ - **Automatic Regex Redactions**: Programmatically locate and redact sensitive PII (Aadhaar numbers, SSNs, credit cards, dates of birth) in a single click.
91
+ - **Discard Unapplied Redactions**: Easily discard individual pending redactions or bulk-discard all unapplied redaction marks before committing.
92
+
93
+ ### 🔍 High-DPI Canvas Rendering & Search
94
+ - **Retina 60 FPS Zoom & Pan**: High-DPI `devicePixelRatio` scaling eliminates blurred text. Micro-debounced rendering enables buttery-smooth 60 FPS trackpad pinching and 360° mouse drag panning.
95
+ - **Contextual Document Search**: Instant client-side text search with real-time match highlighting, result jumping, and match counting.
96
+
97
+ ### 💧 Dynamic Forensic Watermarking
98
+ - Programmatic, non-destructive watermarks rendered on the fly (single centered or full-page tiled) with customizable text, color, opacity, font size, and rotation.
99
+
100
+ ---
101
+
102
+ ## 💻 Developer SDK Usage
103
+
104
+ ### Standard WebViewer Initialization
105
+
106
+ Drop the SDK into any container element with a single function call:
107
+
108
+ ```typescript
109
+ import { WebViewer } from 'teamsync-pdf-viewer';
110
+ import 'teamsync-pdf-viewer/style.css';
111
+
112
+ WebViewer({
113
+ initialDoc: '/sample.pdf',
114
+ initialScale: 1.0, // 100% natural size
115
+ enableAnnotations: true,
116
+ permissions: {
117
+ canRedact: true,
118
+ canAddAnnotations: true
119
+ },
120
+ watermark: {
121
+ text: 'CONFIDENTIAL',
122
+ mode: 'single',
123
+ size: 48,
124
+ opacity: 0.1,
125
+ color: '#dc2626'
126
+ }
127
+ }, document.getElementById('viewer-container')).then((instance) => {
128
+ console.log('TeamSync PDF Viewer is ready!', instance);
129
+
130
+ // Export annotated PDF buffer
131
+ instance.Core.documentViewer.getDocument().getFileData().then((pdfBytes) => {
132
+ console.log('Exported PDF byte length:', pdfBytes.length);
133
+ });
134
+ });
135
+ ```
136
+
137
+ ### Native React Component Usage
138
+
139
+ For native React integration, use the `<DocumentViewer />` component:
140
+
141
+ ```tsx
142
+ import { DocumentViewer } from 'teamsync-pdf-viewer';
143
+ import 'teamsync-pdf-viewer/style.css';
144
+
145
+ function App() {
146
+ return (
147
+ <div style={{ width: '100vw', height: '100vh' }}>
148
+ <DocumentViewer
149
+ initialDoc="/contract.pdf"
150
+ scale={1.0}
151
+ enableAnnotations={true}
152
+ permissions={{ canRedact: true }}
153
+ />
154
+ </div>
155
+ );
156
+ }
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 🛠️ Local Development Quick Start
162
+
163
+ ### 1. Clone & Install
164
+
165
+ ```bash
166
+ git clone https://github.com/angelbot-ai/TeamSync-PDF-Viewer.git
167
+ cd TeamSync-PDF-Viewer
168
+ npm install
169
+ ```
170
+
171
+ ### 2. Launch Dev Server
172
+
173
+ ```bash
174
+ npm run dev
175
+ ```
176
+
177
+ Open `http://localhost:5173` in your browser to launch the live SDK viewer.
178
+
179
+ ---
180
+
181
+ ## 🔌 Extensible Plugin Architecture
182
+
183
+ 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.
184
+
185
+ ```
186
+ ┌─────────────────────────────────────────────────────────┐
187
+ │ TeamSync PDF Viewer Core │
188
+ │ (Page Rendering, Annotations, Redactions, Search) │
189
+ └───────────────────────────┬─────────────────────────────┘
190
+ │ Plugins Registry API
191
+ ┌───────────────────────────▼─────────────────────────────┐
192
+ │ Custom Extension │
193
+ │ (Custom Modals, Action Buttons, Export Hooks) │
194
+ └─────────────────────────────────────────────────────────┘
195
+ ```
196
+
197
+ ---
198
+
199
+ ## 🏛️ Architecture & Tech Stack
200
+
201
+ - **Core Engine**: HTML5, TypeScript, WebAssembly (PDF.js + pdf-lib)
202
+ - **UI & State**: React 19, Lucide Icons, Pure CSS Modules
203
+ - **Build System**: Vite 8 & Oxlint (Sub-500ms tree-shakable builds)
204
+
205
+ ```
206
+ TeamSync-PDF-Viewer/
207
+ ├── src/
208
+ │ ├── components/ # Native React UI (Header, DocumentViewer, Sidebars, Modals)
209
+ │ ├── hooks/ # Search & Keyboard shortcut hooks
210
+ │ ├── utils/ # Redaction algorithms & vector helpers
211
+ │ ├── plugins/ # Plugin API interfaces & registry
212
+ │ ├── index.ts # Main SDK package exports
213
+ │ ├── main.tsx # WebViewer SDK entry point & public API bridge
214
+ │ └── App.tsx # Demo Application Shell
215
+ ├── public/ # Static PDF assets & PDF.js workers
216
+ └── docs/images/ # High-res UI documentation screenshots
217
+ ```
218
+
219
+ ---
220
+
221
+ ## 📄 License
222
+
223
+ Distributed under the **CPAL 1.0 (Common Public Attribution License)**.
224
+ 100% Free and Open Source for personal and commercial usage.
225
+
226
+ ---
227
+ <div align="center">
228
+ <b>AngelBot AI • TeamSync • </b> <a href="https://www.teamsync.com" target="_blank" rel="noopener noreferrer">https://www.teamsync.com</a>
229
+ </div>
230
+
231
+ <div align="center">
232
+ <b>TeamSync PDF Viewer Engine</b> • Engineered with ❤️ for the Open Web.
233
+ </div>
Binary file