mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-13 19:29:10 +08:00
Fix combo field appearances not being shown
This commit is contained in:
parent
6cb58f6327
commit
ae490ec28e
@ -821,18 +821,21 @@ func genFieldComboboxAppearance(form *model.PdfAcroForm, wa *model.PdfAnnotation
|
||||
}
|
||||
}
|
||||
|
||||
// See section 12.7.4.4 "Choice Fields" (pp. 444-446 PDF32000_2008).
|
||||
dchoiceapp := core.MakeDict()
|
||||
for _, optObj := range fch.Opt.Elements() {
|
||||
if optArr, ok := core.GetArray(optObj); ok && optArr.Len() == 2 {
|
||||
optObj = optArr.Get(1)
|
||||
}
|
||||
|
||||
var optstr string
|
||||
if opt, ok := core.GetString(optObj); ok {
|
||||
optstr = opt.Decoded()
|
||||
} else if opt, ok := core.GetName(optObj); ok {
|
||||
optstr = opt.String()
|
||||
} else {
|
||||
if opt, ok := core.GetName(optObj); ok {
|
||||
optstr = opt.String()
|
||||
} else {
|
||||
common.Log.Debug("ERROR: Opt not a name/string - %T", optObj)
|
||||
return nil, errors.New("not a name/string")
|
||||
}
|
||||
common.Log.Debug("ERROR: Opt not a name/string - %T", optObj)
|
||||
return nil, errors.New("not a name/string")
|
||||
}
|
||||
|
||||
if len(optstr) > 0 {
|
||||
|
@ -331,12 +331,12 @@ func fillFieldValue(f *PdfField, val core.PdfObject) error {
|
||||
if len(t.String()) == 0 {
|
||||
return nil
|
||||
}
|
||||
common.Log.Debug("Unexpected string for button/choice field. Converting to name: '%s'", t.String())
|
||||
|
||||
name := core.MakeName(t.String())
|
||||
for _, wa := range f.Annotations {
|
||||
wa.AS = name
|
||||
}
|
||||
f.V = name
|
||||
f.V = val
|
||||
default:
|
||||
common.Log.Debug("ERROR: UNEXPECTED %s -> %v", f.PartialName(), val)
|
||||
f.V = val
|
||||
|
Loading…
x
Reference in New Issue
Block a user