From 6124effdfe5db027b03a8f336eedab3cc12589fd Mon Sep 17 00:00:00 2001 From: Frank Taffelt Date: Mon, 19 Aug 2024 07:35:38 +0200 Subject: [PATCH 1/2] delay setting rotation until a least the first page is ready --- src/app/pdf-viewer/pdf-viewer.component.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/pdf-viewer/pdf-viewer.component.ts b/src/app/pdf-viewer/pdf-viewer.component.ts index 542bd0a6..ad5b60e9 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.ts +++ b/src/app/pdf-viewer/pdf-viewer.component.ts @@ -541,9 +541,10 @@ export class PdfViewerComponent this._rotation !== 0 || this.pdfViewer.pagesRotation !== this._rotation ) { - setTimeout(() => { - this.pdfViewer.pagesRotation = this._rotation; - }); + // wait until at least the first page is available. + this.pdfViewer.firstPagePromise?.then( + () => (this.pdfViewer.pagesRotation = this._rotation) + ); } if (this._stickToPage) { From ffc8f2746efce5b9a4839e0d13f8174ff8c6c8b1 Mon Sep 17 00:00:00 2001 From: Frank Taffelt Date: Mon, 19 Aug 2024 07:40:23 +0200 Subject: [PATCH 2/2] set transform-origin preventing overflow and unnecessary scrollbar --- src/app/pdf-viewer/pdf-viewer.component.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/pdf-viewer/pdf-viewer.component.scss b/src/app/pdf-viewer/pdf-viewer.component.scss index 929fbcbb..5d1c338e 100644 --- a/src/app/pdf-viewer/pdf-viewer.component.scss +++ b/src/app/pdf-viewer/pdf-viewer.component.scss @@ -72,6 +72,7 @@ -moz-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; + transform-origin: 0 0; } .textLayer span,