diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js index ed7450263..a81aa3461 100644 --- a/src/core/xfa/template.js +++ b/src/core/xfa/template.js @@ -1457,6 +1457,13 @@ class Draw extends XFAObject { fixDimensions(this); if ((this.w === "" || this.h === "") && this.value) { + let marginH = 0; + let marginV = 0; + if (this.margin) { + marginH = this.margin.leftInset + this.margin.rightInset; + marginV = this.margin.topInset + this.margin.bottomInset; + } + const maxWidth = this.w === "" ? availableSpace.width : this.w; const fontFinder = this[$globalData].fontFinder; let font = this.font; @@ -1496,11 +1503,11 @@ class Draw extends XFAObject { } if (width !== null && this.w === "") { - this.w = width; + this.w = width + marginH; } if (height !== null && this.h === "") { - this.h = height; + this.h = height + marginV; } } diff --git a/test/pdfs/xfa_bug1716380.pdf.link b/test/pdfs/xfa_bug1716380.pdf.link new file mode 100644 index 000000000..96bc874fa --- /dev/null +++ b/test/pdfs/xfa_bug1716380.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9227435 diff --git a/test/test_manifest.json b/test/test_manifest.json index f203d4b8a..4c2160694 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -930,6 +930,14 @@ "link": true, "type": "load" }, + { "id": "xfa_bug1716380", + "file": "pdfs/xfa_bug1716380.pdf", + "md5": "1351f816f0509fe750ca61ef2bd40872", + "link": true, + "rounds": 1, + "enableXfa": true, + "type": "eq" + }, { "id": "xfa_bug1716047", "file": "pdfs/xfa_bug1716047.pdf", "md5": "2f524163bd8397f43d195090978c3b56",