Checkbox new array values
detlion1643 opened this issue · 1 comments
I don't know all the different layouts for the PDF arrays that can be checkboxes, but the pdf I'm using did not contain "checkbox_no" and "checkbox_yes", but rather just a "checkbox_state". When viewing this, it has the word "Off". I adjusted the the "set_field_checkbox($name, $value)" function to include another if check:
else if(isset($this->value_entries["$name"]["infos"]["checkbox_state_line"]) && isset($this->value_entries["$name"]["infos"]["checkbox_state"])) { $field_checkbox_line=$this->value_entries["$name"]["infos"]["checkbox_state_line"]; if ($field_checkbox_line) { $CurLine =$this->pdf_entries[$field_checkbox_line]; $OldLen=strlen($CurLine); $CurLine = '/AS /'; if($value) { $CurLine .= 'On'; } else { $CurLine .= 'Off'; } $NewLen=strlen($CurLine); $Shift=$NewLen-$OldLen; $this->shift=$this->shift+$Shift; //Saves $this->pdf_entries[$field_checkbox_line]=$CurLine; return $Shift; } else { if ($verbose_set) { echo "<br>Change checkbox value aborted, parsed checkbox definition incomplete."; } }
This does "fill in" my checkbox but not with a "x" or checkmark, but rather just a colored blob/square.
Something new to add to this...
The above works, it's my pdf viewer (okular/firefox) that showed this checkboxes as "blobs/squares". I don't know if this is because of the viewer or the way the checkbox is designed. However, there exists one more issue with it. When showing forms on a viewer, the checkbox is visibly filled in but "not really". By "not really", the actual form itself doesn't think it's filled in, so first click fills in the checkbox again, and subsequent clicks correctly toggle it off/on.
I tried adjusting the line to include adding /V, /DV, and /D values and none of them fix this "initial check" problem. Oh well, it works for what I need...