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.
This commit is contained in:
Jonas Jenwald 2021-03-21 10:41:22 +01:00
parent c6b44d1516
commit 35a088ffc1

View File

@ -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 (