PDF signature
The PDF signature API provides a function that signs a PDF file with a certificate stored in the Syracuse server. The function can be called from the 4GL with the code hereunder.
The function name is pdfsign
.
#**#* This function signs a PDF file using a certificate defined in the Syracuse administration.#*#* @param PDFNAME : Char : PDF name#* @param DATA : Clbfile : Content encoded in base 64#* @param CERTNAME : Char : Name of the certificate to use defined in the Syracuse administration#* @param FUTURE : Integer : Set to 1 to be called in 'future' mode or 0 for the 'wait' mode#* @param RESHEAD : Clbfile : Response header#* @param RESBODY : Clbfile : Signed PDF content#* @return STATUSCODE : Integer : Status code returned by the javascript runner module#*!Funprog PDFSIGN(PDFNAME, DATA, CERTNAME, FUTURE, RETURNS, RESHEAD, RESBODY)Value Char PDFNAMEValue Clbfile DATAValue Char CERTNAMEValue Integer FUTUREValue Char RETURNSVariable Clbfile RESHEAD()Variable Clbfile RESBODY()Local Integer STATUSCODELocal Char MODULE(100) : MODULE = '$pdf'Local Char FONCTION(30) : FONCTION = 'sign'Local Char MODE(10)If (FUTURE = 1) : MODE = 'future' : Else : MODE = 'wait' : EndifLocal Clbfile ARGUMENTS(0)ARGUMENTS = '"' + PDFNAME + '","' + DATA + '","' + CERTNAME + '", {"returnData": true, "encoding": "base64"}'Local Clbfile RESBODY(0)# Call 'sign' functionSTATUSCODE = func ASYRWEBSER.EXEC_JS(MODULE, FONCTION, MODE, ARGUMENTS, '0,1,0,0', 0, RETURNS, '0', RESHEAD, RESBODY)End STATUSCODE
If STATUSCODE is set to 200, RESBODY will contain the signed PDF.For further information, consult our ASYRWEBSER API documentation.