ng2-pdfjs-viewer 26.0.2 → 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
@@ -6,15 +6,16 @@
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
+ [![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)
9
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)
10
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)
11
- [![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)
12
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
- [![PDF.js](https://img.shields.io/badge/PDF.js-6.0.227-green?style=flat-square&logo=mozilla)](https://github.com/mozilla/pdf.js)
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)
14
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)
15
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)
16
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
- [![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)
18
19
 
19
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)
20
21
 
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "ng2-pdfjs-viewer",
3
- "version": "26.0.2",
3
+ "version": "26.0.3",
4
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",