There are two ways to use browser based signatures in PDF files:
1.You can use them in a synchronous way i.e. that the InterForm job sends a request in order to add a written signature, and the job waits endlessly until a signed document has been received. The synchronous options are listed in the section, Use written signatures.
2.You can also use written signatures in an asynchronous way. With this implementation a request is sent to the signing server and then you can poll with another request in order to find out if the document has been signed. The asynchronous way is described in this section.
With the two options you might ask yourself: Which implementation should I use and why? Below the pros and cons for each are listed:
Synchronous |
Asynchronous |
|
Pros |
•Easy to implement. •Fits into existing InterForm400 PDF and Email functions. |
•Very flexible. •Setup any polling interval that you want to verify if a document has been signed. •Option to delete/remove a sign request. |
Cons |
•Holds the (AFC) job while waiting for the document to be signed. •Not very flexible. •Use a predefined, fixed polling interval to test, if the document has been signed. •No option to regret a sign request. |
•Require some programming. |
The components of the asynchronous sign process are these:
1.Define a frame for signing in the overlay, that is used, when the input PDF is created.
2.Upload. Upload of a PDF file to be signed.
3.Send a link to the PDF file, that is to be signed.
4.Delete. Delete document, that has been uploaded, which e.g. is not to be signed.
5.Download. Download signed document.
6.House cleaning. Delete old, signed documents.
Each of these 4 functions are available as programs in the APF3812 library and the header of the source of these programs are included in the source file, APISRC in the APF3812 library. Do NOT compile the programs mentioned, as the source members are not complete.
The source members are meant as an explanation of the format of how the programs should be called.
In short the procedure for signing a PDF file is:
Upload a PDF file to be signed.
Send link to user in order to sign the document.
Wait in a loop:
Start loop
Test with the download function, if the file has been signed yet.
If the file has been signed, then you can exit from the loop.
Here you can verify if the sign request should be deleted. If so: Execute the delete and exit from the loop.
Wait for a while
End loop
If the file is now signed you can pick up and process the signed document.
In the OS400 job scheduler you can consider to independently of the procedure above to do house cleaning: clean up old, signed and unsigned documents.
This image shows the procedure described above:
If you want to upload a PDF file, that is to signed via a browser, then you can do that by calling the program:
APF3812/SGNPDFUC. The program has these parameters:
(You can also see the parameters in the source file member, SGNPDFUC in the source file APF3812/APISRC).
Input fields:
&STMF (256 char)
The input PDF file, that is to be signed. This can e.g. be: '/apf3812home/SignTest.pdf'.
&SGNPAD (32 char)
Identification of the signpad/user, that is to be used. The can e.g. be 'USER1'.
Return fields:
&SIGNOTEC (32 char)
On return this contains a unique ID of the uploaded document as defined by the SignoSign server. You should use this for the download and delete programs.
&SHAREID (128 char)
On return this contains a share ID, that you can use as a part of the link for signing the document. This can be used in links/Mails for direct acces to Document.
&MSGID (7 char)
A return code, that you can use in order to verify, if the PDF file has been uploaded OK. Possible return codes:
* PAD6000; int (int = Uploaded documentID.)
* PAD6001; ERROR: + e.getMessage()
* PAD6002; BAD HTTP Status: " + response.getStatusLine().getStatusCode()
* PAD6003; Parser error: " + pe.getMessage() ;
&MSG256 (256 char)
A description/details of the return code in &MSGID.
After uploading the input file you can send a link to the person, that is to sign the PDF document. The link for the PDF file is:
[HOST]/signoSignUniversal/webvieweropen?action=sharedviewer&u=[USERNAME]&s=[SHAREID]
where:
[HOST] is the URL of the machine, that is running the SignoSign software.
[USERNAME] is the ID of the user in SignoSign, that is to sign the document.
[SHAREID] is the shareID returned, when the upload program is run.
After you have uploaded a PDF file to be signed, you can start to verify, if the document has been signed yet. You do that with the download program: APF3812/SGNPDFDC. The program has these parameters:
(You can also see the parameters in the source file member, SGNPDFDC in the source file APF3812/APISRC).
Input fields:
&SIGNOTEC (32 char)
This is the identification of the uploaded file as returned in the upload program.
Return fields:
&MSGID (7 char)
A return code, that you can use in order to verify, if the PDF file has been signed OK. Possible return codes:
* PAD7000; Signed and download.
* PAD7001; Not signed retry later.
* PAD7002; Document Not found + response.getStatusLine().getStatusCode()
* PAD7002; Parser error - " + pe.getMessage()
* PAD7003; ERROR: + e.getMessage()
* PAD7004; Configuration for error: + e.getMessage()
&MSG256 (256 char)
A description/details of the return code in &MSGID.
If you want to regret a request to sign a PDF document, that has previously been uploaded, then you can run the program, APF3812/SGNPDFXC.
The program has these parameters:
(You can also see the parameters in the source file member, SGNPDFXC in the source file APF3812/APISRC).
Input fields:
&SIGNOTEC (32 char)
This is the identification of the uploaded file as returned in the upload program.
Return fields:
&MSGID (7 char)
A return code, that you can use in order to verify, if the PDF file has been deleted OK. Possible return codes:
* PAD8000; Deleted file id - " + fileIdToDelete.toString()
* PAD7003; ERROR: " + e.getMessage()
&MSG256 (256 char)
A description/details of the return code in &MSGID.
If you want to delete old documents on the sign server, that has previously been uploaded, then you can run the program, APF3812/SGNPDFHC.
The program has these parameters:
(You can also see the parameters in the source file member, SGNPDFHC in the source file APF3812/APISRC).
Input fields:
&DAYSTOKEEP TYPE(*DEC) STG(*AUTO) LEN(3)
Documents older than <&DAYSTOKEEP> days will be deleted from the sign server.
Return fields:
&MSGID (7 char)
A return code, that you can use in order to verify, if the PDF files has been deleted OK. Possible return codes:
* PAD8000; Deleted files.
* PAD7003; ERROR: " + e.getMessage()
&MSG256 (256 char)
A description/details of the return code in &MSGID.