mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
Merge pull request #277 from UglyToad/checkbox-checked-state-tolerance
allow a checkbox to not declare a value and only be checked by appearance #267
This commit is contained in:
commit
864da75d64
@ -478,6 +478,17 @@
|
||||
var isChecked = false;
|
||||
if (!fieldDictionary.TryGetOptionalTokenDirect(NameToken.V, tokenScanner, out NameToken valueToken))
|
||||
{
|
||||
if (fieldDictionary.TryGetOptionalTokenDirect(NameToken.As, tokenScanner, out NameToken appearanceStateName)
|
||||
&& fieldDictionary.TryGetOptionalTokenDirect(NameToken.Ap, tokenScanner, out DictionaryToken _))
|
||||
{
|
||||
// Issue #267 - Use the set appearance instead, this might not work for 3 state checkboxes.
|
||||
isChecked = !string.Equals(
|
||||
appearanceStateName.Data,
|
||||
NameToken.Off,
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
valueToken = appearanceStateName;
|
||||
return (isChecked, valueToken);
|
||||
}
|
||||
valueToken = NameToken.Off;
|
||||
}
|
||||
else if (inheritsValue && fieldDictionary.TryGet(NameToken.As, tokenScanner, out NameToken appearanceStateName))
|
||||
|
Loading…
Reference in New Issue
Block a user