I need to create PDF forms using Antenna House Formatter. The forms need to have both digital-signature and image-input fields.
The digital signature with AHF-CSS works on its own:
input.signature{
display: -ah-form-field;
-ah-field-type: signature;
}
As does the image-input HTML/JavaScript:
<meta name="openaction"
content="#JavaScript=
var f = this.getField('imageInput');
f.setAction('MouseUp', 'event.target.buttonImportIcon();');
"/>
But if I use both together and try to enter a digital signature I get the message:
The document cannot be signed in its current state. Please save the document, close it, reopen it, and then attempt to sign again.
Saving and reopening does not fix the problem. Is there a way to resolve this?
I had to ask Antenna House Support about this. (You could do it if your maintenance is current.) Their answer:
I don't think it will be possible with Formatter and CSS. The 'OpenAction' script modifies the document with this code:
f.setAction('MouseUp', 'event.target.buttonImportIcon();');
Even if you save the document the 'OpenAction' script will run again and modify it.
With XSL-FO you could avoid an OpenAction script by just setting the 'MouseUp' value directly:
<axf:form-field-event name="MouseUp" action-type="javascript">
event.target.buttonImportIcon();
</axf:form-field-event>
'form-field-event' isn't available with CSS.
One horrible work around is to add a check in the 'OpenAction' script to see if the button was already modified. Ex:
var f = this.getField('imageInput');
if (color.equal(f.fillColor, color.red)) {
/* do nothing, this will happen after document is saved */
} else {
f.fillColor = color.red;
f.setAction('MouseUp', 'event.target.buttonImportIcon();');
}
You could 'save' the Formatter generated PDF in Acrobat and then the saved result could get the signature.
There might also or instead be a place to set this.dirty = false;
so that the document isn't seen as modified. (I've previously used this.dirty = false;
in a JavaScript function that toggles layers off and on: I didn't want to be prompted to save the document on closing just because some layers had changed visibility.)