utils/pdf: check radio buttons have kids (#75698)
This commit is contained in:
parent
68fe75434a
commit
7c245b8000
|
@ -99,6 +99,7 @@ class Widget:
|
|||
self.field_type == pdfrw.PdfName.Btn
|
||||
and self.field_flags.is_radio
|
||||
and not self.field_flags.is_push_button
|
||||
and self.kids
|
||||
):
|
||||
return 'radio'
|
||||
elif (
|
||||
|
@ -150,10 +151,14 @@ class Widget:
|
|||
true_values.remove(pdfrw.PdfName.Off)
|
||||
return true_values[0]
|
||||
|
||||
@property
|
||||
def kids(self):
|
||||
return self.annotation.Kids or []
|
||||
|
||||
@property
|
||||
def kids_ordered_by_rect(self):
|
||||
assert self.widget_type == 'radio'
|
||||
kids = list(self.annotation.Kids or [])
|
||||
kids = list(self.kids)
|
||||
|
||||
def compare(kid1, kid2):
|
||||
return rect_compare(Rect.from_pdf_annotation(kid1), Rect.from_pdf_annotation(kid2))
|
||||
|
|
Loading…
Reference in New Issue