Skip to content

Implement printing/saving support for listboxes #12189

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

Closed
timvandermeij opened this issue Aug 9, 2020 · 7 comments · Fixed by #14720
Closed

Implement printing/saving support for listboxes #12189

timvandermeij opened this issue Aug 9, 2020 · 7 comments · Fixed by #14720

Comments

@timvandermeij
Copy link
Contributor

The test file at https://github.com/mozilla/pdf.js/blob/master/test/pdfs/annotation-choice-widget.pdf contains listboxes, which are not rendered correctly when printed right now. These kinds of fields are made by https://github.com/mozilla/pdf.js/blob/master/src/display/annotation_layer.js#L672-L678.

/cc @calixteman

@timvandermeij timvandermeij added printing annotations form-acroform Gecko 81 Tracking work planned for Form Fill in Shirley 81 release labels Aug 9, 2020
@calixteman
Copy link
Contributor

tbh I don't really know how to proceed here.
For example with single selection, we can render the list and render the highlighted element but when this one is the last one for example then it won't be rendered... It works like this in evince and pdfium, so if you're ok we can do the same.
Could you assign me on this bug ?

@timvandermeij
Copy link
Contributor Author

I have assigned you to this bug. Fortunately listboxes are not as common as the already implemented widgets. We should try to do what Adobe Reader/Acrobat does since that it our reference implementation and what most users would expect.

@timvandermeij timvandermeij changed the title Implement printing support for listboxes Implement printing/saving support for listboxes Aug 16, 2020
@timvandermeij timvandermeij removed the Gecko 81 Tracking work planned for Form Fill in Shirley 81 release label Aug 21, 2020
@blizzardengle
Copy link

I noticed that this was removed from the To do list and the Form fill project board was closed. Searching through the public commits and the pre-release version 2.9.359 it doesn't look like the issue with multi-select (listboxes) was solved.

Is there any update or timeline on getting multi-select working for printing/ saving? The comment addressing the issues can be found in the annotations_layer here:

// For printing/saving we currently only support choice widgets with one
// option selection. Therefore, listboxes (#12189) and comboboxes (#12224)
// are not properly printed/saved yet, so we only store the first item in
// the field value array instead of the entire array. Once support for those
// two field types is implemented, we should use the same pattern as the
// other interactive widgets where the return value of `getValue`
// is used and the full array of field values is stored.

@stephanrauh
Copy link

stephanrauh commented Mar 20, 2022

@Snuffleupagus closed #14696 as "duplicate", but I suspect the bug has become worse since February 12, 2021. The code snippet @blizzardengle quotes indicates that printing did work once upon a time, it just reduced the list to the first selected option. Now it doesn't print any option.

@calixteman
Copy link
Contributor

I'll work on that stuff asap.

@stephanrauh
Copy link

@calixteman Awesome. Thanks!

calixteman added a commit to calixteman/pdf.js that referenced this issue Mar 26, 2022
calixteman added a commit to calixteman/pdf.js that referenced this issue Mar 27, 2022
calixteman added a commit to calixteman/pdf.js that referenced this issue Mar 29, 2022
calixteman added a commit to calixteman/pdf.js that referenced this issue Mar 29, 2022
@stephanrauh
Copy link

@calixteman Thanks!

conghoang added a commit to conghoang/pdf.js that referenced this issue Apr 7, 2022
* commit '27e738dff951160420575216c080e22027af0a86': (198 commits)
  Refactor some xfa*** getters in document.js - it's a follow-up of PR mozilla#14735.
  Convert `web/debugger.js` to a *basic* module
  Update translations to the most recent versions
  Update dependencies to the most recent versions
  Update GitHub Actions workflow steps to the most recent versions
  Replace most loops in `web/debugger.js` with `for...of` loops
  Decode non-ASCII values found in the xfa:datasets (PR 14735 follow-up)
  [Annotations] Some annotations can have their values stored in the xfa:datasets - it aims to fix mozilla#14685; - add a basic object to get values from the parsed datasets; - these annotations don't have an appearance so we must create one when printing or saving.
  [GENERIC viewer] Try to improve a11y, for search results, in the findbar (issue 14525)
  Don't manually convert `setAttribute` values to strings (PR 14554 follow-up)
  Use `String.prototype.repeat()` in a couple of spots
  [Annotations] Add support for printing/saving choice list with multiple selections - it aims to fix issue mozilla#12189.
  Add a `<dialog>` polyfill for the `generic-legacy` build
  Try to improve a11y for the `PasswordPrompt` and `PDFDocumentProperties` dialogs
  Re-factor the `OverlayManager` class to use a `WeakMap` internally
  Convert the existing overlays to use `<dialog>` elements (issue 14698)
  [text selection] Add the whitespaces present in the pdf in the text chunk - it aims to fix issue mozilla#14627; - the basic idea of the recent text refactoring was to only consider the rendered visible whitespaces.   But sometimes, the heuristics aren't correct and although some whitespaces are in the text stream   they weren't in the text chunks because they were too small. Hence we added some exceptions, for example,   we always add a whitespace when it is between two non-whitespace chars but only when in the same Tj.   So basically, this patch removes the constraint to have the chars in the same Tj   (in using a circular buffer to save the two last chars) but don't add a space when the visible space is really   too small (hence `NOT_A_SPACE_FACTOR`).
  Change the type of the `container` property, in the `TextLayerRenderParameters` typedef (issue 14716)
  Avoid the `textLayer` becoming visible in high contrast mode (issue 13230)
  Remove the remaining `dir`-dependent CSS rules
  ...

# Conflicts:
#	package-lock.json
#	src/pdf.js
bh213 pushed a commit to bh213/pdf.js that referenced this issue Jun 3, 2022
rousek pushed a commit to signosoft/pdf.js that referenced this issue Aug 10, 2022
@marco-c marco-c moved this to Closed in PDF.js quality Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

4 participants