diff --git a/src/core/document.js b/src/core/document.js index 8c3dd6f5c..7a01d94ca 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -1382,15 +1382,18 @@ class PDFDocument { if (!acroForm) { return; } - const resources = await acroForm.getAsync("DR"); - if (!(resources instanceof Dict)) { - return; + // Without any fonts in /DR, the XFA layout still needs a font finder: + // the fonts it uses are then all loaded as missing fonts. + let resources = await acroForm.getAsync("DR"); + if (resources instanceof Dict) { + await ObjectLoader.load(resources, ["Font"], this.xref); + } else { + resources = Dict.empty; } - await ObjectLoader.load(resources, ["Font"], this.xref); - const fontRes = resources.get("Font"); + let fontRes = resources.get("Font"); if (!(fontRes instanceof Dict)) { - return; + fontRes = Dict.empty; } const options = Object.assign( diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 565bb239d..1cff29819 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -638,6 +638,7 @@ !issue20324.pdf !bug1815476.pdf !issue16021.pdf +!xfa_without_dr_fonts.pdf !bug1770750.pdf !issue19971.pdf !issue16063.pdf diff --git a/test/pdfs/xfa_without_dr_fonts.pdf b/test/pdfs/xfa_without_dr_fonts.pdf new file mode 100644 index 000000000..fd0788426 Binary files /dev/null and b/test/pdfs/xfa_without_dr_fonts.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index 1dde0f768..d44e6252f 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -8000,6 +8000,15 @@ "rounds": 1, "type": "eq" }, + { + "id": "xfa_without_dr_fonts", + "file": "pdfs/xfa_without_dr_fonts.pdf", + "md5": "80d3a2f5eb7332010ca35d33348d4011", + "rounds": 1, + "enableXfa": true, + "type": "eq", + "about": "Pure XFA form without fonts in the AcroForm /DR." + }, { "id": "issue3207", "file": "pdfs/issue3207r.pdf",