digital signature newbie questions

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
govie
Posts: 1
Joined: Fri May 06 2005

digital signature newbie questions

Post by govie »

I have a requirement to apply a p7c (digital ID) signature to a PDF file programatically, through VB6.

Can Amyuni pdfcreator prof help me to do this?
I downloaded the trial version, but cannot find an API documentation. Where can i find documentation about digital singing with amyuni products..?

many thanks,

govie
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Yes, the PDF Creator professional version enables you to add a Digital Signature to the pdf documents.

Please check the DigitalSignature() function in the Developers' manual "PDF Creator Developer Manual.pdf". You will find this manual under Program Files / Amyuni folder.

Hope this helps.
fpuyuelo
Posts: 3
Joined: Fri Apr 07 2006

Example

Post by fpuyuelo »

has anyone an example of use?

I work with VFP, and I need sign digitally a PDF. I try to understand the documentation but I can't.

I could read an example with VB, and rewrite it my selff into VFP.

Thanks in advance.
fpuyuelo
Posts: 3
Joined: Fri Apr 07 2006

Example

Post by fpuyuelo »

Hello Fernando,

Please find here a code to sign a PDF document. This is a VBA code. Please note that this code doesn't include all the general declarations, you need to add the declarations for the different variables yourself.

I guess you already posted your question to the forum. Please feel free to post the below code or the variation that you will be using so other customers having the same question and browsing the forum will check it.

==============================Code starts here ===============================

Public cdi As CDIntfEx.CDIntfEx
Public pdfdoc as CDIntfEx.Document

Private Sub AxDigitalSignature_Click()

'******This code Digitally sign an existing PDF document ******/

' Note: You need to have a Professional version of the PDF Converter
' and a valid signature on your system to be able to sign a PDF document

' Open the pdf file to be exported - This feature is available only in the Professional version of the driver
PdfDoc.Open (MyDirectory + "ActiveXSample.pdf")

' SetLicenseKey is needed with some advanced funtions like DigitalSignature
PdfDoc.SetLicenseKey LicensedTo, ActivationCode

' DigitalSignature: the signature name here is "Test2".
PdfDoc.DigitalSignature "TestSignature", "Testing", MyDirectory + "signature.jpg", "Montreal", 1, 5000, 4000, 2000, 2000, 1 + 2 + 4 + 8 + 32 + 64

'Save the signed document
PdfDoc.Save MyDirectory + "SignedDocument.pdf"

End Sub

============================= Code ends here ==================================

Hope this helps. If you need further information please send a message to either support@amyuni.com or to me directly so your request will not be processed twice.

Best Regards,

Joanna Khoury
Amyuni Technologies
www.amyuni.com
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

Below is an activex VFP code snippet which illustrates how to implements Digital Signatures.

Hope this helps?



**Create Document Object
PDFdoc = CREATEOBJECT("CDIntfEx.Document")
PDFdoc.SetLicenseKey (license_to,actvation_code)

**Open document you want to sign
bResult = PDFdoc.Open("C:\temp\Document1.pdf")

IF (bResult ) THEN
WITH PDFdoc
**'/////////////////////////////////////////////////////////////
*!* 'Signer name 1
*!* 'Reason for signing 2
*!* 'Location 4
*!* 'Associated image 8
*!* 'Date of signing 32
*!* 'Signature type 64

*!* 'SignerName
*!* 'This is the friendly name of the digital signature as it appears to the user when the digital certificate is installed
*!* 'on the system. In most cases, this is the full name of the person signing the document.

*!* 'Reason
*!* 'Reason for signing the document. Can be an empty string if no reason
*!* 'is specified.

*!* 'ImageFile
*!* 'Full path of the file containing the image that is associated with the signature.
*!* 'This is optional, a digital signature does not always contain an image.

*!* 'location
*!* 'Physical location of the person who signed the document. This parameter is optional.

*!* 'PageNumber
*!* 'Page number on which to insert the signature. Page numbers start with 1,
*!* 'the value -1 indicates the last page in the document.

*!* 'HorzPos , VertPos
*!* 'Horizontal and vertical position of the digital signature in Twips.

*!* 'Width, Height
*!* 'Width and height of the digital signature in Twips.

*!* 'flags
*!* 'Combination of flags that determine how the digial signature appears on the page. A value of 0 indicates that
*!* 'the signature is invisible.

.DigitalSignature ("Jose Num3","Aprroved", "c:\sign.bmp", "Montreal, Canada", -1, 0, 0, 3000, 3000, 1 + 2 + 4 + 8 + 32 + 64)

.Save ("c:\sample_sign.pdf")

ENDWITH
ENDIF
PDFdoc = 0
RETURN
fpuyuelo
Posts: 3
Joined: Fri Apr 07 2006

Example VFP

Post by fpuyuelo »

Thanks to everybody.


Here I send a code that work perfectly.


* A Professional version of the PDF Creator is needed to use Digital Signature.

* You need to have a valid Signature on your system to be able to sign the document

PUBLIC CreatorRef
CreatorRef = CREATEOBJECT("PDFCreactiveX.PDFCreactiveX")

PUBLIC obj as ACPDFCREACTIVEX.acObject

PUBLIC Licensee
Licensee = "PDF Creator Evaluation License"

PUBLIC ActivationCode
ActivationCode = "07EFCD...8DDE901C19E9326"

CreatorRef.SetLicenseKey (Licensee, ActivationCode)
CreatorRef.Open (GETFILE("pdf"), "")
CreatorRef.DigitalSignature ("Fernando Puyuelo Ossorio", "Signature", "", "MAdrid", "1", 500, 400, 300, 300, 1+2+4+8+64)
CreatorRef.Save ("SignedDocument.pdf", 0)
orc
Posts: 3
Joined: Tue May 01 2007

Post by orc »

When i try to sign with my developer version 3.0 the pdf, i always get an error in the pdf file. In this case the sign is invisible.

With my professinal version 2.5 i can sign the pdf, but when i set some parameters like width, hpos, vpos, .. and image to the signature options, the pdf have problem too.

I suposse i can sign the pdf files without buy the creator.

Thnaks


orlando R.
Post Reply