fix text-annotation state options (#412)

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
Nikita Pozdeev 2021-12-28 16:07:45 +04:00 committed by GitHub
parent 66df6587ac
commit 61d6386639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8418,8 +8418,13 @@ class TCPDF {
} else {
$annots .= ' /Name /Note';
}
$hasStateModel = isset($pl['opt']['statemodel']);
$hasState = isset($pl['opt']['state']);
$statemodels = array('Marked', 'Review');
if (isset($pl['opt']['statemodel']) AND in_array($pl['opt']['statemodel'], $statemodels)) {
if (!$hasStateModel && !$hasState) {
break;
}
if ($hasStateModel AND in_array($pl['opt']['statemodel'], $statemodels)) {
$annots .= ' /StateModel /'.$pl['opt']['statemodel'];
} else {
$pl['opt']['statemodel'] = 'Marked';
@ -8430,7 +8435,7 @@ class TCPDF {
} else {
$states = array('Accepted', 'Rejected', 'Cancelled', 'Completed', 'None');
}
if (isset($pl['opt']['state']) AND in_array($pl['opt']['state'], $states)) {
if ($hasState AND in_array($pl['opt']['state'], $states)) {
$annots .= ' /State /'.$pl['opt']['state'];
} else {
if ($pl['opt']['statemodel'] == 'Marked') {