Digital Signature

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Icunune
Posts: 24
Joined: Thu Sep 04 2003

Digital Signature

Post by Icunune »

Hi,

I have the latest version of PDF Converter Developer Pro 3.0. I want to add a digital signature into my pdf files with Visual Fox Pro 9.0
I get examples for your forum, but it doesn’t works okey.

I've installed the printer with this command:
run /n1 install.exe -s "Amyuni PDF Converter" -n "UserName" -c "license code"

I've registered the all libraries of pdf

First example:

pdfdoc=CREATEOBJECT("CDIntfEx.Document")
pdfdoc.SetLicenseKey("Licencia","Activate Code")
lOpen=pdfdoc.open("c:\prueba.pdf")
if lOpen
lAdd=pdfdoc.DigitalSignature ("Entidad","razon firma", "c:\firma.bmp", "Barcelona", -1, 0, 0, 3000, 3000,8)
if lAdd
pdfdoc.Save ("c:\prueba_sign.pdf")
endif
endif

** lAdd variable is False. DigitalSignature return false

Second Example:

CreatorRef = CREATEOBJECT("PDFCreactiveX.PDFCreactiveX")
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)

The DigitalSignature function returns “Denied Access” message error


Can you tell me some solution?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Digital Signature

Post by Joan »

Hello,

Here is a sample code on calling the DigitalSignature function

pdfdoc.DigitalSignature "Signature2048bits", "My reason for signing the document", "C:\Temp\signature.jpg", "USA", 1, 1000, 1000, 2000, 2000, 1 + 2 + 4 + 8 + 32 + 64

Your second sample is right but you need to make sure that there is a signature on the PC called "Fernando Puyuelo Ossorio". Also the '1' shouldn't be in quotation, it is an integer and not a string.

Please make sure that you have the professional version of the PDF Converter. The Digital Signature feature is only in the professional version.

Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Icunune
Posts: 24
Joined: Thu Sep 04 2003

Re: Digital Signature

Post by Icunune »

Hi Joan and everybody

My function to sing my pdf's works okey now, but sometimes when execute the next sentence ((( pdfdoc.Save ("c:\prueba_sign.pdf") )))

OLE exception error: Exception code c0000005. OLE object may be corrupt

Do you know because this error message is produced?

I try to uninstall my pdf converter and install again, but sometimes give me this message

Thank You
Have a nice day!!
Best regards
Sergio
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

In cdintf300.h there is no definition for function DigitalSignature, can you please provide one or tell me where I can download an updated include file ?

TIA
Davide Zaccanti
Devteam
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal
Contact:

Re: Digital Signature

Post by Devteam »

We have a tool on our web site that validates the certificate being used and gives a better indication of why DigitalSignature might be failing. You can download the tool from:
http://www.amyuni.com/downloads/digisign_test.zip

The crash when saving might be related to the specific PDF file being used. You would need to open a support ticket in order for us to investigate that.
http://www.amyuni.com/en/support/perincident.html

Using DigitalSignatures from a DLL interface is not very straightforward (question by Zaksoft), you need to use the following DLL functions:
// set the permanent license key for the product
BOOL WINAPI SetLicenseKeyA(LPCSTR szCompany, LPCSTR szLicKey);
// Open the document, handle returned in pedhDocument
int WINAPI DocOpenA(EXTDOCHANDLE* pedhDocument, LPCSTR szFileName, LPCSTR szPassword);
// Sign the document
int WINAPI DocDigitalSignatureA(EXTDOCHANDLE edhDocument, LPCSTR SignedBy, LPCSTR Reason, LPCSTR ImageFile, LPCSTR Location, long PageNumber, long HorzPos, long VertPos, long Width, long Height, long Flags);
// Save the document
int WINAPI DocSaveA(EXTDOCHANDLE edhDocument, LPCSTR szFileName);
// Close the document
int WINAPI DocClose(EXTDOCHANDLE edhDocument);
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at - https://www.amyuni.com
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

I've inserted the declaration as described, all code compile fine, but when linking I've got:

Error 2 error LNK2019: unresolved external symbol "int __stdcall DocDigitalSignatureA(void *,char const *,char const *,char const *,char const *,long,long,long,long,long,long)"

Sure of all parameters ?
Davide Zaccanti
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Digital Signature

Post by Joan »

Hello,

Your code is right but you may have an old version of CDIntf or an old .h file.

Please make sure that you have the right .h file for your version of CDIntf and if your version is old you can upgrade it by contacting support@amyuni.com

Hope this helps.
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

I will send an email, but it's the latest one zip file (re-downloaded also yesterday) that pdf manul points to.

TIA
Davide Zaccanti
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

..no answer from support... cona you please investigate if they have received my mail ?

TIA.
Davide Zaccanti
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Digital Signature

Post by Joan »

Hello ,

I will check this.

Please let me know which version of the driver you are currently using? Is it 3.0 or 3.02 or 3.02a?
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

The latest available for download (marked 3.02 - PDF Suite).

Can be a good idea to restore on the login page for download updates the header with information about version, it has been present for a while (claiming 3.02 dec 2007) but now is not shown and i have to doenload weekly the package to verify if it is updated..

TIA
Davide Zaccanti
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Digital Signature

Post by Joan »

Hello,

We are currently updating the log in page. I am sure we are planning to add the date and version number of each release, i will mention this to the concerned person however.

I will check if our technical support received your email. Mainly we need to check if the version you have has the Digital Signature function and if it does you need to make sure that you are using the corresponding .h file.

I will check this and get back to you
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
Icunune
Posts: 24
Joined: Thu Sep 04 2003

Re: Digital Signature

Post by Icunune »

Hi. I have 3.02 version.

Now I'll try to send an email to support department.

Thanks
zaksoft
Posts: 66
Joined: Fri Feb 20 2004

Re: Digital Signature

Post by zaksoft »

I've received both .h and .lib from support (thank you).

1) .h is dated 2007 and there is no definition of DigitalSignature(...)

2) there are other errors, like definitions ( MergeFiles.. LinearizeDocument.. etc) that have to be moved outside extern C declaration to avoid link errors (I've done the some with any other previous .h) for mangled names

3) With new .LIB the program compiles without errors.. now I've to verify if the call works as expected, it may tooks few days for problems related to my smart card..

Hope this helps also other people..

P.S. I normally add also a #pragma for automatic lib linking in my .h, can be a suggestion for upcoming 3.03 when .h and .lib will be updated
Davide Zaccanti
Icunune
Posts: 24
Joined: Thu Sep 04 2003

Re: Digital Signature

Post by Icunune »

Hi Joan,
I have the 3.02 version of pdf converter. And the version of the CDIntf.dll is 3.0.2.0

I continue having the same message error.

When execute the next sentence ((( pdfdoc.Save ("c:\prueba_sign.pdf") )))
OLE exception error: Exception code c0000005. OLE object may be corrupt

What can I do? can you tell me a solution?

Thank you
Post Reply