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 , german health cards and others.
If you use as function name sign_file instead then you can also pass as infile a NON PDF document. Aloaha will create as outfile an enveloped PKCS7 file. It is suggested to give the outfile the extension p7m.
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
'text signatures work only if in Aloaha settings
'incremental signatures have been disabled
'HKCU\Software\Aloaha\pdf\ForceIncrementalSignature = 0
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)Please ask...
Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!
i have a pdf document, which i generate using vb6 coding.Now i need it to be digitally signed that is stored on a card (like an ActivCard) with PIN protection.how can i do this?
You can use the PDF Siganture sample here on this page. But you need to have an evaluation key. Please contact info@aloaha for such a key.
Answered 30.07.2009
If not, please do not hesitate to send us your question.
We would be glad to answer it.
Home / Knowledge Base / PDF SDK / PDF Signature API / VB6 Signature sample