1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

[XFA] Add alt text for images. (bug 1723418)

Not many XFA PDFs have alt text.

Some examples:
bug1723422.pdf
xfa_bug1718670_1.pdf
xfa_issue13611.pdf
xfa_issue13633.pdf
xfa_issue13634.pdf
This commit is contained in:
Brendan Dahl 2021-08-03 15:55:13 -07:00
parent 6cf1ee3251
commit 3e003245b1
2 changed files with 41 additions and 0 deletions

View file

@ -3312,12 +3312,14 @@ class Image extends StringObject {
};
break;
}
const parent = this[$getParent]();
return HTMLResult.success({
name: "img",
attributes: {
class: ["xfaImage"],
style,
src: URL.createObjectURL(blob),
alt: parent ? ariaLabel(parent[$getParent]()) : null,
},
});
}