From 35a088ffc1598dde8520dafa2cb2e1e9729d4c90 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 21 Mar 2021 10:41:22 +0100 Subject: [PATCH] Don't provide the `enableXfa` parameter to the `BaseViewer` constructor, and avoid the fallback bar with `enableXfa = true` set (PR 13069 follow-up) Given that the `enableXfa` parameter must to be passed to the API/Worker, and thus included in the `getDocument` call, it's not necessary to include it when initializing the `PDFViewer`-instance used in the default viewer. (Also, in `AppOptions`, the parameter is clearly marked with `OptionKind.API`.) Furthermore, we probably don't want to display the fallback bar (in Firefox) for XFA documents when `enableXfa = true` is set. --- web/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/app.js b/web/app.js index f2fa7f2d8..e2f317fdb 100644 --- a/web/app.js +++ b/web/app.js @@ -518,7 +518,6 @@ const PDFViewerApplication = { useOnlyCssZoom: AppOptions.get("useOnlyCssZoom"), maxCanvasPixels: AppOptions.get("maxCanvasPixels"), enableScripting: AppOptions.get("enableScripting"), - enableXfa: AppOptions.get("enableXfa"), }); pdfRenderingQueue.setViewer(this.pdfViewer); pdfLinkService.setViewer(this.pdfViewer); @@ -1561,7 +1560,12 @@ const PDFViewerApplication = { this.setTitle(contentDispositionFilename); } - if (info.IsXFAPresent && !info.IsAcroFormPresent) { + if ( + info.IsXFAPresent && + !info.IsAcroFormPresent && + // Note: `isPureXfa === true` implies that `enableXfa = true` was set. + !pdfDocument.isPureXfa + ) { console.warn("Warning: XFA is not supported"); this._delayedFallback(UNSUPPORTED_FEATURES.forms); } else if (