Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiline textfields for printing #12176

Merged
merged 1 commit into from Aug 9, 2020

Conversation

calixteman
Copy link
Contributor

No description provided.

@calixteman calixteman changed the title Multiline Support multiline textfields for printing Aug 5, 2020
@timvandermeij timvandermeij added annotations form-acroform Gecko 81 Tracking work planned for Form Fill in Shirley 81 release printing labels Aug 5, 2020
@timvandermeij timvandermeij added this to In progress in Form fill Aug 5, 2020
Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with the comments addressed (only the second commit was checked here since the rest is in another PR).

src/core/annotation.js Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
src/core/annotation.js Outdated Show resolved Hide resolved
test/unit/annotation_spec.js Outdated Show resolved Hide resolved
test/unit/annotation_spec.js Outdated Show resolved Hide resolved
test/unit/annotation_spec.js Outdated Show resolved Hide resolved
@calixteman calixteman force-pushed the multiline branch 3 times, most recently from 0ce33be to 0255383 Compare August 7, 2020 07:47
@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/c6d638315bba106/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 1

Live output at: http://54.215.176.217:8877/210370c17404f51/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/c6d638315bba106/output.txt

Total script time: 27.14 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/c6d638315bba106/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/210370c17404f51/output.txt

Total script time: 29.09 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/210370c17404f51/reftest-analyzer.html#web=eq.log

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/d8e6829479eef88/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 7, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/d8e6829479eef88/output.txt

Total script time: 3.51 mins

Published

@timvandermeij
Copy link
Contributor

timvandermeij commented Aug 7, 2020

This doesn't seem to be working correctly. I tried inserting text into the multiline textfield from https://github.com/mozilla/pdf.js/blob/master/test/pdfs/annotation-text-widget.pdf (and other PDFs), but the print result is an empty textfield. Note that this is also a good test document for the combs patch (it was created by Acrobat so it should be according to the specification). Could you check what's going wrong here?

@calixteman
Copy link
Contributor Author

I didn't manage to reproduce using print button but I managed to have an incorrect behaviour using keyboard shortcut (and in this case change event was not triggered so I replaced it with input event).
Anyway, could you try again ?
I fixed a bug with \r as line separator and with non-empty fields which have been changed into empty ones.
I'll add some tests in the weekend.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/a931282262c09f9/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 8, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/a931282262c09f9/output.txt

Total script time: 3.48 mins

Published

@timvandermeij
Copy link
Contributor

Unfortunately the problem remains. Steps to reproduce:

  1. Visit http://54.67.70.0:8877/a931282262c09f9/web/viewer.html (preview link above)
  2. Run PDFViewerApplication.preferences.set('renderInteractiveForms', true) in the console and refresh.
  3. Download https://github.com/mozilla/pdf.js/blob/master/test/pdfs/annotation-text-widget.pdf and open the file with the viewer.
  4. Enter multiline text in the textarea.
  5. Click the print button in the toolbar or Ctrl-P and print the result to PDF.

Attached is the result I get from this:
out.pdf

@@ -462,7 +462,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
element.setAttribute("value", textContent);
}

element.addEventListener("change", function (event) {
element.addEventListener("input", function (event) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a problem here, shouldn't it also be changed for checkbox and radio button widgets from previous PRs? If so, please change that in a separate commit.

@calixteman
Copy link
Contributor Author

It was because of the alignment var created after its use... I wonder why neither the linter nor firefox dev edition didn't catch it...
Anyway I fixed it and added a test for multiple possible EOL.
About the event: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event
So it seems that change is ok for checkbox and radios.

@calixteman
Copy link
Contributor Author

/botio-linux preview

1 similar comment
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Linux m4)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/4a1ee2567cfed4a/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/4a1ee2567cfed4a/output.txt

Total script time: 3.40 mins

Published

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Linux m4)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.67.70.0:8877/1f9adaa5e814b17/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Windows)


Received

Command cmd_test from @timvandermeij received. Current queue size: 0

Live output at: http://54.215.176.217:8877/6304f783de0a303/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/1f9adaa5e814b17/output.txt

Total script time: 27.04 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.67.70.0:8877/1f9adaa5e814b17/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Aug 9, 2020

From: Bot.io (Windows)


Failed

Full output at http://54.215.176.217:8877/6304f783de0a303/output.txt

Total script time: 30.00 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: FAILED

Image differences available at: http://54.215.176.217:8877/6304f783de0a303/reftest-analyzer.html#web=eq.log

@timvandermeij timvandermeij merged commit b061c30 into mozilla:master Aug 9, 2020
@timvandermeij
Copy link
Contributor

This works fine now; thanks!

@timvandermeij timvandermeij moved this from In progress to Done in Form fill Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
annotations form-acroform Gecko 81 Tracking work planned for Form Fill in Shirley 81 release printing
Projects
No open projects
Form fill
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants