Skip to content

Instantly share code, notes, and snippets.

@escapewindow
Created August 20, 2020 22:06
Show Gist options
  • Save escapewindow/2e13c19e1ba47e25c09570e234c7f509 to your computer and use it in GitHub Desktop.
Save escapewindow/2e13c19e1ba47e25c09570e234c7f509 to your computer and use it in GitHub Desktop.
broken xfa diff
diff --git a/web/app.js b/web/app.js
index c2cbe1119..929cb9865 100644
--- a/web/app.js
+++ b/web/app.js
@@ -1418,14 +1418,18 @@ const PDFViewerApplication = {
this.setTitle(contentDispositionFilename);
}
- if (info.IsXFAPresent) {
- console.warn("Warning: XFA is not supported");
- } else if (
- info.IsAcroFormPresent &&
- !this.pdfViewer.renderInteractiveForms
- ) {
- console.warn("Warning: AcroForm support is not enabled");
- this._delayedFallback(UNSUPPORTED_FEATURES.forms);
+ if (info.IsAcroFormPresent) {
+ const fields = pdfDocument.acroForm.get("fields");
+ if (
+ info.IsXFAPresent &&
+ (!Array.isArray(fields) || fields.length === 0)
+ ) {
+ console.warn("Warning: XFA is not supported");
+ this._delayedFallback(UNSUPPORTED_FEATURES.forms);
+ } else if (!this.pdfViewer.renderInteractiveForms) {
+ console.warn("Warning: AcroForm support is not enabled");
+ this._delayedFallback(UNSUPPORTED_FEATURES.forms);
+ }
}
// Telemetry labels must be C++ variable friendly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment