diff --git a/fitz/helper-fields.i b/fitz/helper-fields.i index 3a6805a62..721dc34fe 100644 --- a/fitz/helper-fields.i +++ b/fitz/helper-fields.i @@ -1097,6 +1097,14 @@ class Widget(object): for x in apnt: nstates.append(x.split()[0]) states["normal"] = nstates + if APN[0] == "xref": + nstates = [] + nxref = int(APN[1].split(" ")[0]) + APN = doc.xref_object(nxref) + apnt = APN.split("/")[1:] + for x in apnt: + nstates.append(x.split()[0]) + states["normal"] = nstates APD = doc.xref_get_key(xref, "AP/D") if APD[0] == "dict": dstates = [] @@ -1105,6 +1113,14 @@ class Widget(object): for x in apdt: dstates.append(x.split()[0]) states["down"] = dstates + if APD[0] == "xref": + dstates = [] + dxref = int(APD[1].split(" ")[0]) + APD = doc.xref_object(dxref) + apdt = APD.split("/")[1:] + for x in apdt: + dstates.append(x.split()[0]) + states["down"] = dstates return states def on_state(self): diff --git a/src/__init__.py b/src/__init__.py index cd50d029d..3ae84cad7 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -6992,6 +6992,14 @@ def button_states(self): for x in apnt: nstates.append(x.split()[0]) states["normal"] = nstates + if APN[0] == "xref": + nstates = [] + nxref = int(APN[1].split(" ")[0]) + APN = doc.xref_object(nxref) + apnt = APN.split("/")[1:] + for x in apnt: + nstates.append(x.split()[0]) + states["normal"] = nstates APD = doc.xref_get_key(xref, "AP/D") if APD[0] == "dict": dstates = [] @@ -7000,6 +7008,14 @@ def button_states(self): for x in apdt: dstates.append(x.split()[0]) states["down"] = dstates + if APD[0] == "xref": + dstates = [] + dxref = int(APD[1].split(" ")[0]) + APD = doc.xref_object(dxref) + apdt = APD.split("/")[1:] + for x in apdt: + dstates.append(x.split()[0]) + states["down"] = dstates return states @property