diff --git a/src/core/evaluator.js b/src/core/evaluator.js index f5646b3623c561..5e9d7b8fac1ac0 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -2816,6 +2816,10 @@ class PartialEvaluator { } } + if (keepWhiteSpace) { + compareWithLastPosition(0); + } + return; } diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index b4c5725b5bfd87..640aa418471272 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -624,3 +624,4 @@ !bug1871353.pdf !bug1871353.1.pdf !file_pdfjs_form.pdf +!issue17492.pdf diff --git a/test/pdfs/issue17492.pdf b/test/pdfs/issue17492.pdf new file mode 100644 index 00000000000000..6ed4e3f041381b Binary files /dev/null and b/test/pdfs/issue17492.pdf differ diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index e0a349506ac4b0..182cde99b0d664 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -2550,6 +2550,20 @@ describe("api", function () { await loadingTask.destroy(); }); + fit("read content from multline textfield containing an empty line", async function () { + const loadingTask = getDocument(buildGetDocumentParams("issue17492.pdf")); + const pdfDoc = await loadingTask.promise; + const pdfPage = await pdfDoc.getPage(1); + const annotations = await pdfPage.getAnnotations(); + + const field = annotations.find(annotation => annotation.id === "144R"); + expect(!!field).toEqual(true); + expect(field.fieldValue).toEqual("Several\n\nOther\nJobs"); + expect(field.textContent).toEqual(["Several", "", "Other", "Jobs"]); + + await loadingTask.destroy(); + }); + describe("Cross-origin", function () { let loadingTask; function _checkCanLoad(expectSuccess, filename, options) {