We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Just came across this while searching for same--I'm using the Federal W4 form, and it's set up similarly. First of all, trying to modify the object returned by getFormFieldDict() isn't going to get you anywhere. It says right in the docs that it's supposed to be treated as a read-only construct; it's not really a pointer to the dictionary object. Second, after much futzing around, I figured out that something like this works (snipping from your code above):
I found that when a checkbox is checked manually, there are three properties that different from one that's not checked:
However, changing the value of the 'value' key on 'DV' and 'V' didn't seem to do anything for me. That is, these statements didn't seem to do anything:
Reason being . . . 'DV' and 'V' stand for 'Default Value' and 'Value', respectively. In the inner workings of a PDF form, these values are useful for processing and whatnot, but unlike in the DOM or something like that, the *value* of the checkbox and whether an actual checkmark appears in that box are not necessarily the same (if you're setting them programmatically). Hence, the 'AS' key, which stands for 'Appearance State'. Setting the value AS's 'value' key thus places a checkmark there. So, depending on what you're doing with this form, you may also want to set 'DV' and/or 'V' the same way, like if you're actually presenting it as a web form complete with some Javascript or other logic. In my case, I'm just filling the forms in with data from a database and sending them straight to the printer, so I don't care about the actual checkbox values. Hope this helps. In reply to Re: Filling PDF Form Checkboxes
by jwagon
|
|