Digital Signature API Code sample
Please find below a code sample for the Aloaha digital signature API. The Aloaha PDF Suite Enterprise Version is required to use the digital signature API. Please contact us for an evaluation key. The code sample can be downloaded here.
Multiple Signatures with incremental annotations
Please find below some code samples for download. They demontrate how to apply multiple signatures to one document and additional add some
"Sticky Notes".
Sample Code as VBS (5,53 KB)
Sample Code as TXT (5,53 KB)
Sample Code as PDF (44,23 KB)
Simplified code can bee seen here!
'This sample script demonstrates how to sign PDF Document
'with Adobe.PPKMS signatures
'Copyright 2005 Wrocklage Intermedia GmbH
'Redistribution without permission not allowed
'Signature API only
enabled with Aloaha PDF Suite Enterprise Version
Dim pdf 'aloaha object
Dim reason 'signature reason
Dim location 'signature physical location
Dim infile 'inputpdf
Dim outfile 'outputpdf - can be the same as inputpdf
Dim image 'image to be used for signature - empty string allowed
Dim cert 'certificate to be used. Can be either UniqueContainerName or Serialnumber
Dim x1 'x start mediabox
Dim y1 'y start mediabox
Dim x2 'x end mediabox
Dim y2 'y end mediabox
Dim ph 'pageheight - 0 for auto
Dim pw 'pagewidth - 0 for auto
Dim xoff 'x-offset if page does not start at 0
Dim yoff 'y-offset if page does not start at 0
Dim mediabox 'mediabox string
Dim page 'page to be used
Dim px1 'x1 coordinate as percentage of full page (upper left)
Dim py1 'y1 coordinage as percentage of full page (upper left)
Dim px2 'x2 coordinage as percentage of full page (lower right)
Dim py2 'y2 coordinage as percentage of full page (lower right)
px1 = 84
py1 = 8
px2 = 99
py2 = 2
xoff = 0
yoff = 0
reason = "I created this document"
location = "I am in the office"
'set unique container name of certificate. serialnumber can be also used
cert ="9e82c38e348ddcf70d58e0a21f56d6f6_dc4ff486-0fc3-4b64-b582-b94a2eba4ba5"
'set page where signature will be shown
page = 1
'set file names
infile = "c:\pdf\input.pdf"
outfile = "c:\pdf\output.pdf"
'create object
Set pdf = CreateObject("aloahapdf.edit")
pdf.currentpage = CLng(page)
'set signature imagepath. Must be a color jpg file.
'Empty string also possible
image = pdf.aloahapath+"jpg\george1.jpg"
'mediabox etc only needed if pagesize is unknown
'and autodetect should not be used.
mediabox = pdf.get_pagesize_s(CStr(infile),CLng(page))
If mediabox<>"" Then
x1=Trim(split(mediabox)(0))
y1=Trim(split(mediabox)(1))
x2=Trim(split(mediabox)(2))
y2=Trim(split(mediabox)(3))
ph=Abs(y2-y1)
pw=Abs(x2-x1)
Else
ph=0
pw=0
End If
'set pageheight and pagewidth to 0 for autodetect
'ph=0
'pw=0
If ph >0 Then
yoff = ((y1/ph)*100)\1
Else
yoff = 0
End If
If pw >0 Then
xoff = ((x1/pw)*100)\1
Else
xoff = 0
End if
Call pdf.sign_pdf_file(CStr(infile), CStr(outfile), CLng(pw), CLng(ph), CLng(px1+xoff), CLng(py1+yoff), CLng(px2+xoff), CLng(py2+yoff), CStr(reason), CStr(location), CStr(cert), CStr(image))
Set pdf = nothing
Sample PDF DocumentPlease ask...
Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!
We need to add, programmatically, a digital signature (certificate) to PDF/A-1b compliant files; does your API/COM object maintain PDF/A compliance, or would the resulting signed file be non-compliant?
Please check our signature API. To get an evaluation key please contact info@aloaha.com
Answered 15.06.2009
i am in wichita, ks, USA
i am building a website for medical workers to login, see a list of pdf files to view using their browser, and press a "Digital Sign this Document" button and my server will digitally sign that document using a digital signature file stored on the server.
can i purchase your software in the usa?
how much does it cost?
is there a limit on how many documents i can sign using your software?
Hi,
you can purchase our softare in our online store or via email to info@aloaha.com. You can also purchase it at usasmartcard.com.
There is no limit on how many documents you can sign.
Answered 08.05.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