From e992013474b65d53066e78ee90d6a24fb1087a9f Mon Sep 17 00:00:00 2001 From: Derek Liang Date: Wed, 28 Aug 2024 18:38:32 -0700 Subject: [PATCH 1/3] apply @shamoon fix --- src/app/pdf-viewer/pdf-viewer.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index 542bd0a6..3db5913d 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -32,7 +32,6 @@ import type { PDFViewerOptions, ZoomScale } from './typings'; -import { PDFSinglePageViewer } from 'pdfjs-dist/web/pdf_viewer'; if (!isSSR()) { assign(PDFJS, 'verbosity', PDFJS.VerbosityLevel.INFOS); @@ -63,7 +62,7 @@ export class PdfViewerComponent public eventBus!: PDFJSViewer.EventBus; public pdfLinkService!: PDFJSViewer.PDFLinkService; public pdfFindController!: PDFJSViewer.PDFFindController; - public pdfViewer!: PDFJSViewer.PDFViewer | PDFSinglePageViewer; + public pdfViewer!: PDFJSViewer.PDFViewer | PDFJSViewer.PDFSinglePageViewer; private isVisible = false; @@ -434,6 +433,10 @@ export class PdfViewerComponent } private setupViewer() { + if (this.pdfViewer) { + this.resetPdfDocument(); + } + assign(PDFJS, 'disableTextLayer', !this._renderText); this.initPDFServices(); From bea2b437b6f91d7cdd0f788c616198677c1ddead Mon Sep 17 00:00:00 2001 From: Derek Liang Date: Wed, 28 Aug 2024 18:43:07 -0700 Subject: [PATCH 2/3] apply @shamoon second fix --- src/app/pdf-viewer/pdf-viewer.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index 3db5913d..148d1859 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -434,7 +434,7 @@ export class PdfViewerComponent private setupViewer() { if (this.pdfViewer) { - this.resetPdfDocument(); + this.pdfViewer.setDocument(null as any); } assign(PDFJS, 'disableTextLayer', !this._renderText); From 620b9af6d549450662d88f7d5319404a5179da2f Mon Sep 17 00:00:00 2001 From: Derek Liang Date: Wed, 28 Aug 2024 18:46:27 -0700 Subject: [PATCH 3/3] update package name and version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 40d3e043..6fa67035 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "ng2-pdf-viewer", - "version": "10.2.2", + "name": "ng2-pdf-viewer-2", + "version": "11.0.0", "description": "Angular 5+ component for rendering PDF", "license": "MIT", "scripts": {