Aloaha VB6 Digital Signature API Sample
The following will demonstrate on how to use the Aloaha digital signature API to sign a PDF document. Please note that we use in this example the error event to detect any possible errors while signing.
You might have seen that we supply even the Smarcard PIN. That is only possible with native supported cards such as the T-Systems Telesec, Infineon SiCrypt and others.
Please contact our support department if you have questions regarding the Aloaha signature API or if you requiere an evaluation key.
To use the sample code please create an empty form in your VB6 project and create a button called
"sign". The
aloahapdf objects needs to be referenced as well!
Dim WithEvents pdf As aloahapdf.edit
Private Sub Sign_Click()
On Error Resume Next
Dim reason As String
Dim location As String
Dim infile As String
Dim outfile As String
Dim cert As String
'define signature reason
reason = "I created this document"
'define signator location
location = "I am in the office"
'use native supported smartcard in first cardreader
cert = "0"
'define inputfile
infile = "c:\pdf\input.pdf"
'define outputfile
outfile = "c:\pdf\output.pdf"
'load, sign and unload
Set pdf = New aloahapdf.edit
pdf.signaturecontent = "Signed at@@lf@@@@date@@@@lf@@with @@signature@@'s digital certificate.@@lf@@No further signature necessary."
pdf.PIN = "250620"
Call pdf.sign_pdf_file(CStr(infile), CStr(outfile), 0, 0, 0, 0, 0, 0, CStr(reason), CStr(location), CStr(cert), "")
If pdf.sign_pdf_file_returnstring <> "" Then
'Problem while signing!
MsgBox pdf.sign_pdf_file_returnstring
End If
Set pdf = Nothing
End Sub
Private Sub pdf_LastErrorMessage(errormessage As String)
'display errors
MsgBox errormessage
End Sub
CommandLineSignator.zip (7,73 KB)
Aloaha Software / Knowledge Base / PDF SDK / PDF Signature API / VB6 Signature sample