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

Get urls if any in AA::D dictionary for pushbuttons

This commit is contained in:
Calixte Denizet 2020-10-15 19:42:36 +02:00
parent a373137304
commit ce3d3a6ff8
3 changed files with 80 additions and 6 deletions

View file

@ -1905,12 +1905,16 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
}
_processPushButton(params) {
if (!params.dict.has("A") && !this.data.alternativeText) {
if (
!params.dict.has("A") &&
!params.dict.has("AA") &&
!this.data.alternativeText
) {
warn("Push buttons without action dictionaries are not supported");
return;
}
this.data.isTooltipOnly = !params.dict.has("A");
this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
Catalog.parseDestDictionary({
destDict: params.dict,

View file

@ -1165,10 +1165,23 @@ class Catalog {
let action = destDict.get("A"),
url,
dest;
if (!isDict(action) && destDict.has("Dest")) {
// A /Dest entry should *only* contain a Name or an Array, but some bad
// PDF generators ignore that and treat it as an /A entry.
action = destDict.get("Dest");
if (!isDict(action)) {
if (destDict.has("Dest")) {
// A /Dest entry should *only* contain a Name or an Array, but some bad
// PDF generators ignore that and treat it as an /A entry.
action = destDict.get("Dest");
} else {
action = destDict.get("AA");
if (isDict(action)) {
if (action.has("D")) {
// MouseDown
action = action.get("D");
} else if (action.has("U")) {
// MouseUp
action = action.get("U");
}
}
}
}
if (isDict(action)) {