VB6 code for op.document.addDigitalSignature no longer working  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

VB6 code for op.document.addDigitalSignature no longer working  SOLVED

Post by prime clinical systems »

Hi, Upgraded to V8, and this code that was working fine in V6 383 no longer works, I get error Invalid Procedure Call at Op.Do: Was previously resolved due to signature size see post viewtopic.php?f=66&t=28973&p=112943#p112943
I tried my certificate and signature image in the End User product, and everything works fine, see attached image

Dim nID As Long
Dim Op As PDFXEditCtl.IOperation
nID = Me.PDF.Inst.Str2ID("op.document.addDigitalSignature")
Set Op = Me.PDF.Inst.CreateOp(nID)
Dim Options As PDFXEditCtl.CoAUX_Cab
Dim Input1 As PDFXEditCtl.CoAUX_Cab
Set Input1 = Op.Params.Root("Input")
Dim Doc As PDFXEditCtl.IPXC_Document
Set Doc = Me.PDF.Doc.CoreDoc
Input1.Add().v = Doc

Set Options = Op.Params.Root("Options")
Options("FieldName").v = FField.FullName
Options("DocMDP").v = 3
Options("DigiSigType").v = 1
Options("FileCertificate").v = "C:\Users\username\username & ".pfx"
Options("UseFileCertificate").v = True
Options("CertificatePassword").v = "abcdefg"
Options("AskDestinationFileName").v = False
Options("DestinationFileName").v = ""
Dim appear As CoAUX_Cab
Set appear = Options("SignatureAppearance")
appear("HasTemplate").v = True
Dim Temp As CoAUX_Cab
Set Temp = appear("Template")
Temp("GraphicType").v = 2
Temp("GraphicName").v = SigPath
Temp("TextDirection").v = 0
Temp("ShowName").v = True
Temp("ShowDate").v = True
Temp("ShowLabels").v = True
Temp("ShowLogo").v = True
Op.Do

Even if I remove the graphic, still same error
Temp("GraphicType").v = 0
Temp("GraphicName").v = ""

Please check if something no longer supported, or bug introduced in my code. Note the certificate was generated by the control as well, and password has been double checked to be correct.
Thanks
Attachments
Capture.PNG
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: VB6 code for op.document.addDigitalSignature no longer working

Post by prime clinical systems »

Well, I found that now must specify Destination filename, before this was not the case, it allows you to use the source document path so overwrites the open doc just fine, but the documentation sure doesn't say this is required now, but anyway, issue resolved, after several hours of trial and error. Did not see this in the changelog either, but at least working.

Options("AskDestinationFileName").v = False
Options("DestinationFileName").v = SourceDocPath
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: VB6 code for op.document.addDigitalSignature no longer working

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

Glad that you have managed to find a solution.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply