Skip to content

Commit 16c8d04

Browse files
committed
Fixes
#288 #286
1 parent e16a534 commit 16c8d04

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

SampleApp/src/app/features/features.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ <h2 class="interactive-title">Document Loading Error</h2>
14541454
<div class="external-viewer-host">
14551455
<ng2-pdfjs-viewer
14561456
#externalBlobViewer
1457+
viewerId="externalBlobViewer"
14571458
[externalWindow]="true"
14581459
[urlValidation]="true"
14591460
[diagnosticLogs]="diagnosticLogs"

SampleApp/src/app/features/features.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class FeaturesComponent implements OnInit {
112112
public errorMessage = "Custom error message for demonstration";
113113

114114
// Theme & Visual Customization
115-
public theme: "light" | "dark" | "auto" = "light";
115+
public theme: "light" | "dark" | "auto" = "auto";
116116
public primaryColor = "#007acc";
117117
public backgroundColor = "";
118118
public pageBorderColor = "";

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng2-pdfjs-viewer",
3-
"version": "25.0.14",
3+
"version": "25.0.15",
44
"description": "The most comprehensive Angular PDF viewer powered by Mozilla PDF.js. 7M+ downloads, mobile-first, production-ready with complete rewrite in v25.x",
55
"author": {
66
"name": "Aneesh Goapalakrishnan",

lib/pdfjs/web/postmessage-wrapper.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@
2323
// Get the initial file URL from query parameters
2424
const urlParams = new URLSearchParams(window.location.search);
2525
const currentFileUrl = urlParams.get('file');
26+
const viewerId = urlParams.get('viewerId') || 'default';
2627

27-
// Check if we already have a stored original URL
28-
const storedOriginalUrl = sessionStorage.getItem('ng2-pdfjs-viewer-original-file-url');
28+
// Check if we already have a stored original URL for this viewer
29+
const storageKey = `ng2-pdfjs-viewer-original-file-url-${viewerId}`;
30+
const storedOriginalUrl = sessionStorage.getItem(storageKey);
2931

3032
if (storedOriginalUrl) {
3133
// Use the stored original URL (from previous page load)
3234
originalFileUrl = storedOriginalUrl;
3335
} else if (currentFileUrl) {
3436
// Store the current URL as the original (first time loading)
3537
originalFileUrl = currentFileUrl;
36-
sessionStorage.setItem('ng2-pdfjs-viewer-original-file-url', originalFileUrl);
38+
sessionStorage.setItem(storageKey, originalFileUrl);
3739
}
3840
}
3941

lib/src/ng2-pdfjs-viewer.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export class PdfJsViewerComponent
309309
// #endregion
310310

311311
// #region Theme & Visual Customization Properties
312-
@Input() public theme: "light" | "dark" | "auto" = "light";
312+
@Input() public theme: "light" | "dark" | "auto" = "auto";
313313
@Input() public primaryColor?: string;
314314
@Input() public backgroundColor?: string;
315315
@Input() public pageBorderColor?: string;
@@ -1553,7 +1553,7 @@ export class PdfJsViewerComponent
15531553
// Queue theme and visual customization configurations
15541554
// Always queue theme to ensure initial styles are applied
15551555

1556-
this.queueConfiguration("theme", this.theme || "light", "set-theme");
1556+
this.queueConfiguration("theme", this.theme || "auto", "set-theme");
15571557

15581558
if (this.primaryColor) {
15591559
this.queueConfiguration(

0 commit comments

Comments
 (0)