Codebeispiel der digitalen Signatur API
Nachfolgend finden Sie ein Codebeispiel für die digitale Signatur API. Die Aloaha PDF Suite Enterprise Version ist notwendig um die digitale Signatur API verwenden zu können. Kontaktieren Sie uns, um einen Test-Lizenzschlüssel zu bekommen. Das Codebeispiel kann auch hier heruntergeladen werden.
Vereinfachter Code kann hier angesehen werden!
Dieses Beispielscript demonstriert, wie man PDF-Dokumente mit Adobe.PPKMS Signaturen signiert.
'Copyright 2005 Wrocklage Intermedia GmbH
'Weiterverteilung ohne ausdrückliche Erlaubnis nicht gestattet.
'Die Signatur API ist NUR in der
Aloaha PDF Suite Enterprise Version aktiviert.
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 = "Ich habe dieses Dokument erstellt"
location = "Ich bin im Büro"
'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
incstickynotes.pdf (149,63 KB)
Home / Support / Aloaha PDF SDK / PDF Signatur API