diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js index 76f23c91c..0670377c1 100644 --- a/src/core/xfa/template.js +++ b/src/core/xfa/template.js @@ -5288,13 +5288,14 @@ class Template extends XFAObject { } else if (target instanceof ContentArea) { const index = contentAreas.findIndex(e => e === target); if (index !== -1) { + // In the next loop iteration `i` will be incremented, note the + // `continue` just below, hence we need to subtract one here. i = index - 1; } else { targetPageArea = target[$getParent](); - startIndex = - targetPageArea.contentArea.children.findIndex( - e => e === target - ) - 1; + startIndex = targetPageArea.contentArea.children.findIndex( + e => e === target + ); } } continue; diff --git a/test/pdfs/issue13751.pdf.link b/test/pdfs/issue13751.pdf.link new file mode 100644 index 000000000..169f17cdb --- /dev/null +++ b/test/pdfs/issue13751.pdf.link @@ -0,0 +1 @@ +https://github.com/mozilla/pdf.js/files/6834770/Oswiadczenie_o_statusie_FATCA_i_CRS-1.pdf diff --git a/test/test_manifest.json b/test/test_manifest.json index 5ff77b568..f1c65dddc 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -1356,6 +1356,15 @@ "enableXfa": true, "type": "eq" }, + { "id": "issue13751", + "file": "pdfs/issue13751.pdf", + "md5": "b9960bfa99be3573d9c32a9d55e5b7da", + "link": true, + "rounds": 1, + "lastPage": 1, + "enableXfa": true, + "type": "eq" + }, { "id": "issue13756", "file": "pdfs/issue13756.pdf", "md5": "67040c6df3b5039fcbc81bf63b7c7f98",