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

Field missing text comb #13633

Open
JDziurlaj opened this issue Jun 26, 2021 · 2 comments
Open

Field missing text comb #13633

JDziurlaj opened this issue Jun 26, 2021 · 2 comments
Labels

Comments

@JDziurlaj
Copy link

Attach (recommended) or Link to PDF file here:
https://www.jobcenter-remscheid.de/files/jobcenter-remscheid/download/anzeige-kug101_ba013134.pdf
Configuration:

  • Web browser and its version: Firefox Nightly 91.0a1 (2021-06-25) (64-bit)
  • Operating system and its version: Windows 10.0.19043.1052
  • PDF.js version: N/A

Steps to reproduce the problem:

  1. enableXFA in Firefox Nightly
  2. Open form

What is the expected behavior? (add screenshot)
Text in field is combed (vertical bars)
image
(numbers added for illustration)

What went wrong? (add screenshot)
No comb appears.
image

calixteman added a commit to calixteman/pdf.js that referenced this issue Jul 3, 2021
  - and ceil the reserve for a caption to avoid to split it;
  - both issues are present in the pdf in issue mozilla#13633.
@symtalha14
Copy link
Contributor

symtalha14 commented Jul 15, 2021

pdf.js/src/core/document.js

Lines 1266 to 1274 in 64f86de

getPage(pageIndex) {
if (this._pagePromises[pageIndex] !== undefined) {
return this._pagePromises[pageIndex];
}
const { catalog, linearization } = this;
if (this.xfaFactory) {
return Promise.resolve(
new Page({

In the getPage() function, I think there's some issue with the pageDict object being passed to Page Class in case of xfaFactory. We are sending an empty dict. Due to which:

The parsedAnnotations function ensures annotations but the call to annotations() return an empty array.

pdf.js/src/core/document.js

Lines 495 to 497 in 64f86de

get _parsedAnnotations() {
const parsedAnnotations = this.pdfManager
.ensure(this, "annotations")

Here, we are trying to get "annots" and passing the key to the _getInheritableProperty. (Call to annotations returns empty array)

pdf.js/src/core/document.js

Lines 490 to 494 in 64f86de

get annotations() {
const annots = this._getInheritableProperty("Annots");
return shadow(this, "annotations", Array.isArray(annots) ? annots : []);
}

When the annotations() func makes a call to _getInheritableProperty, simply returns an empty array because the Dict is sent empty.(to getInheritableProperty as described next)

pdf.js/src/core/document.js

Lines 119 to 122 in 64f86de

_getInheritableProperty(key, getArray = false) {
const value = getInheritableProperty({
dict: this.pageDict,
key,

Now the getInheritableProperty function in core/core_utils.js receives an empty dict from _getInheritableProperty and sends back an empty array.

function getInheritableProperty({
dict,
key,
getArray = false,
stopWhenFound = true,

Hence, the annotations aren't being taken care of and the annotation layer is not present.

That's what I think. Please let me know your understanding of the same.

bh213 pushed a commit to bh213/pdf.js that referenced this issue Jun 3, 2022
  - and ceil the reserve for a caption to avoid to split it;
  - both issues are present in the pdf in issue mozilla#13633.
@kwisatz
Copy link

kwisatz commented Aug 15, 2022

Job centers seem to be very fond of XFA forms.
Here's another job-center form from Luxembourg that uses combed fields for IBAN and social security numbers: CAE.pdf

As in the example above, they are not rendered as such using pdf.js, nor does pdf.js apply any character limits.

combed_pdfjs
combed_adobe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants