]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Update document-detail.component.ts
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 30 Oct 2025 22:14:44 +0000 (15:14 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Fri, 31 Oct 2025 00:00:15 +0000 (17:00 -0700)
src-ui/src/app/components/document-detail/document-detail.component.ts

index 4e0d3259f8ac62b0b507cc7af6e826b14350b442..e7197b9b91d2fbfa289ccf25032a0e75828df514 100644 (file)
@@ -1448,16 +1448,23 @@ export class DocumentDetailComponent
               iframe.contentWindow.focus()
               iframe.contentWindow.print()
               iframe.contentWindow.onafterprint = () => {
-                timer(500).subscribe(() => {
-                  // delay to avoid print failure
+                timer(100).subscribe(() => {
+                  // delay to avoid FF print failure
                   document.body.removeChild(iframe)
                   URL.revokeObjectURL(blobUrl)
                 })
               }
             } catch (err) {
-              this.toastService.showError($localize`Print failed.`, err)
-              timer(500).subscribe(() => {
-                // delay to avoid print failure
+              const isCrossOriginAfterPrintError =
+                err instanceof DOMException &&
+                (err.name === 'SecurityError' ||
+                  err.message.includes('onafterprint')) &&
+                err.message.includes('cross-origin')
+              if (!isCrossOriginAfterPrintError) {
+                this.toastService.showError($localize`Print failed.`, err)
+              }
+              timer(100).subscribe(() => {
+                // delay to avoid FF print failure
                 document.body.removeChild(iframe)
                 URL.revokeObjectURL(blobUrl)
               })