ng2-pdfjs-viewer 26.0.1 → 26.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/README.md CHANGED
@@ -1,19 +1,21 @@
1
1
  <div align="center">
2
2
 
3
- <img src="https://raw.githubusercontent.com/intbot/ng2-pdfjs-viewer/master/lib/logo.svg" alt="ng2-pdfjs-viewer" width="120" height="140" />
3
+ <img src="https://raw.githubusercontent.com/intbot/ng2-pdfjs-viewer/master/lib/pdf-viewer-banner.png" alt="#1 Angular PDF Viewer — ng2-pdfjs-viewer: AI-enabled, feature-rich and comprehensive. 8.3M+ downloads, 0 runtime dependencies, 8 years (since 2018), Angular 10–22." width="880" />
4
4
 
5
5
  # ng2-pdfjs-viewer
6
6
 
7
7
  **A complete PDF experience in one Angular component — view, annotate, sign, fill forms, search, and read aloud, powered by Mozilla PDF.js.**
8
8
 
9
- [![npm](https://img.shields.io/npm/v/ng2-pdfjs-viewer?logo=npm&color=blue)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
10
- [![downloads / month](https://img.shields.io/npm/dm/ng2-pdfjs-viewer?color=orange)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
11
- [![total downloads](https://img.shields.io/badge/total-7M%2B-brightgreen?logo=npm)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
12
- [![PDF.js](https://img.shields.io/badge/PDF.js-6.0.227-green?logo=mozilla)](https://github.com/mozilla/pdf.js)
13
- [![Angular](https://img.shields.io/badge/Angular-%3E%3D10-red?logo=angular)](https://angular.dev)
14
- [![license](https://img.shields.io/badge/license-Apache--2.0%20%2B%20Commons%20Clause-blue.svg)](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/LICENSE)
15
- [![stars](https://img.shields.io/github/stars/intbot/ng2-pdfjs-viewer?logo=github)](https://github.com/intbot/ng2-pdfjs-viewer)
16
- [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/intbot/ng2-pdfjs-viewer/badge)](https://scorecard.dev/viewer/?uri=github.com/intbot/ng2-pdfjs-viewer)
9
+ [![total downloads](https://img.shields.io/badge/total%20downloads-8.3M%2B-22c55e?style=flat-square&logo=npm)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
10
+ [![npm version](https://img.shields.io/npm/v/ng2-pdfjs-viewer?style=flat-square&logo=npm&color=2563eb)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
11
+ [![downloads / month](https://img.shields.io/npm/dm/ng2-pdfjs-viewer?style=flat-square&color=f97316)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
12
+ [![runtime dependencies](https://img.shields.io/badge/runtime%20deps-0-success?style=flat-square)](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/BILL-OF-MATERIALS.md)
13
+ [![types](https://img.shields.io/npm/types/ng2-pdfjs-viewer?style=flat-square)](https://www.npmjs.com/package/ng2-pdfjs-viewer)
14
+ [![CodeQL](https://github.com/intbot/ng2-pdfjs-viewer/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/intbot/ng2-pdfjs-viewer/security/code-scanning)
15
+ [![Angular](https://img.shields.io/badge/Angular-%3E%3D10-red?style=flat-square&logo=angular)](https://angular.dev)
16
+ [![PDF.js](https://img.shields.io/badge/PDF.js-6.0.227-green?style=flat-square&logo=mozilla)](https://github.com/mozilla/pdf.js)
17
+ [![license](https://img.shields.io/badge/license-Apache--2.0%20%28Commons%20Clause%29-blue?style=flat-square)](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/LICENSE)
18
+ [![stars](https://img.shields.io/github/stars/intbot/ng2-pdfjs-viewer?style=flat-square&logo=github)](https://github.com/intbot/ng2-pdfjs-viewer)
17
19
 
18
20
  [**Live demo**](https://angular-pdf-viewer-demo.vercel.app/) · [**Documentation**](https://angular-pdf-viewer-docs.vercel.app/) · [**API reference**](https://angular-pdf-viewer-docs.vercel.app/docs/api/component-inputs) · [**Changelog**](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/CHANGELOG.md)
19
21
 
@@ -22,11 +24,11 @@
22
24
  ---
23
25
 
24
26
  Drop a production PDF viewer into any Angular app with a single tag. ng2-pdfjs-viewer wraps
25
- Mozilla **PDF.js 6** in one declarative `<ng2-pdfjs-viewer>` component: rendering, navigation,
27
+ **PDF.js 6** in one declarative `<ng2-pdfjs-viewer>` component: rendering, navigation,
26
28
  search, printing, theming, annotations, e-signatures, AcroForms, read-aloud, and a bring-your-own
27
29
  AI assistant — all driven by typed `@Input()`s and `@Output()` events, no iframe plumbing of your own.
28
30
 
29
- Shipping since **2018**, **7M+ downloads**, mobile-first, and built & verified on **Angular 22**
31
+ Shipping since **2018**, **8.3+ million downloads**, mobile-first, and built & verified on **Angular 22**
30
32
  while keeping a wide `>=10` peer range so existing apps upgrade without churn.
31
33
 
32
34
  ```bash
@@ -43,7 +45,7 @@ That's the whole integration. [Wire up the assets](#-quick-start) and you have a
43
45
 
44
46
  | | |
45
47
  |---|---|
46
- | 📄 **View anything** | Crisp PDF.js 6 rendering, zoom, navigation, thumbnails, outline, printing — embedded, in a new tab, or a popout window. |
48
+ | 📄 **View anything** | Crisp, high-fidelity rendering, zoom, navigation, thumbnails, outline, printing — embedded, in a new tab, or a popout window. |
47
49
  | ✍️ **Annotate & sign** | Highlight, draw, free-text, and stamp editors; opt-in draw/type/upload **signature** editor and threaded comments. Export and restore edits for a full server round-trip. |
48
50
  | 🧾 **Fill forms** | Two-way AcroForm binding — read and write field values from your component, save the filled document as a blob. |
49
51
  | 🔎 **Search in code** | Programmatic `search()` with totals, per-page counts, and next/previous navigation — build your own find UI. |
@@ -197,13 +199,13 @@ See [CONTRIBUTING.md](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/CON
197
199
 
198
200
  ## 📄 License
199
201
 
200
- [Apache-2.0 with the Commons Clause](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/LICENSE). Free to use, modify, and self-host; the Commons
202
+ [Apache-2.0 (Commons Clause)](https://github.com/intbot/ng2-pdfjs-viewer/blob/master/LICENSE). Free to use, modify, and self-host; the Commons
201
203
  Clause restricts selling the software itself as a hosted/commercial product.
202
204
 
203
205
  ## 🙏 Acknowledgments
204
206
 
205
207
  Built on the excellent [Mozilla PDF.js](https://github.com/mozilla/pdf.js), and shaped over the
206
- years by a community of contributors and 7M+ downloads' worth of real-world use.
208
+ years by a community of contributors and 8.3+ million downloads' worth of real-world use.
207
209
 
208
210
  ---
209
211
 
@@ -2347,11 +2347,16 @@ class PdfJsViewerComponent {
2347
2347
  const base = this.viewerFolder
2348
2348
  ? `${this.viewerFolder}/web/viewer.html`
2349
2349
  : `assets/pdfjs/web/viewer.html`;
2350
- let viewerUrl = `${base}?file=${fileUrl}`;
2350
+ // Control params go in the query string first; the file URL is appended
2351
+ // LAST. A consumer's file URL may end in a hash fragment that PDF.js reads
2352
+ // for navigation (e.g. doc.pdf#search=foo, #page=2). Anything appended
2353
+ // after the file param would land inside that fragment instead of the
2354
+ // query string - so file trails the whole URL, leaving the hash where
2355
+ // PDF.js looks for it. (#305)
2356
+ let viewerUrl = `${base}?urlValidation=${this.urlValidation === false ? 0 : 1}`;
2351
2357
  if (typeof this.viewerId !== "undefined") {
2352
2358
  viewerUrl += `&viewerId=${this.viewerId}`;
2353
2359
  }
2354
- viewerUrl += `&urlValidation=${this.urlValidation === false ? 0 : 1}`;
2355
2360
  // Init-time PDF.js options (signature editor, page colors, passthrough).
2356
2361
  // These are read by PDF.js during initialize() - before the postMessage
2357
2362
  // channel exists - so they ride the viewer URL and are applied by the
@@ -2367,6 +2372,8 @@ class PdfJsViewerComponent {
2367
2372
  if (isDevMode()) {
2368
2373
  viewerUrl += `&_t=${Date.now()}`;
2369
2374
  }
2375
+ // File last (see above): its optional #hash fragment must trail the URL.
2376
+ viewerUrl += `&file=${fileUrl}`;
2370
2377
  return viewerUrl;
2371
2378
  }
2372
2379
  // Merge the dedicated convenience inputs with the raw pdfJsOptions
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ng2-pdfjs-viewer",
3
- "version": "26.0.1",
4
- "description": "The most comprehensive Angular PDF viewer, powered by Mozilla PDF.js 6 — view, annotate, sign, fill forms, search, and read aloud from one component. 7M+ downloads, mobile-first, production-ready.",
3
+ "version": "26.0.3",
4
+ "description": "The most comprehensive Angular PDF viewer, powered by Mozilla PDF.js 6 — view, annotate, sign, fill forms, search, and read aloud from one component. 8.3M+ downloads, mobile-first, production-ready.",
5
5
  "author": {
6
6
  "name": "Aneesh Goapalakrishnan",
7
7
  "email": "codehippie1@gmail.com"
@@ -51,7 +51,7 @@
51
51
  "accessibility",
52
52
  "open-source"
53
53
  ],
54
- "license": "Apache-2.0 + Commons Clause",
54
+ "license": "Apache-2.0 (Commons Clause)",
55
55
  "readme": "README.md",
56
56
  "exports": {
57
57
  "./package.json": {
@@ -166,6 +166,12 @@ body #outerContainer.sidebar-right.viewsManagerOpen #loadingBar {
166
166
  /* Light theme defaults */
167
167
  .ng2-theme-light,
168
168
  .ng2-theme-light-active {
169
+ /* Pin the UA color-scheme so PDF.js's light-dark() colours (toolbar/menu
170
+ icons, form controls, scrollbars) resolve to the SELECTED theme instead of
171
+ the OS preference. Without this, when the app theme differs from the OS
172
+ theme the icons inherit :root's `color-scheme: light dark` and become
173
+ invisible (e.g. light icons on a light toolbar). */
174
+ color-scheme: light;
169
175
  --ng2-default-bg: #d4d4d7; /* PDF.js original grey background */
170
176
  --ng2-default-text: #000000;
171
177
  --ng2-default-toolbar: #f9f9f9;
@@ -175,6 +181,7 @@ body #outerContainer.sidebar-right.viewsManagerOpen #loadingBar {
175
181
  /* Dark theme defaults */
176
182
  .ng2-theme-dark,
177
183
  .ng2-theme-dark-active {
184
+ color-scheme: dark;
178
185
  --ng2-default-bg: #1e1e1e;
179
186
  --ng2-default-text: #ffffff;
180
187
  --ng2-default-toolbar: #333333;