Digital Sig placed fails on color document  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

Digital Sig placed fails on color document

Post by prime clinical systems »

Hi, this code for digital signature from my other post works fine if document is black and white or grey scale, but not color, I attached a sample page and need to see what can be done to get this to work on that document. I notice if after signing with this code the signatures pane says the signature exists, but is not visible.

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 = SourceDocPath
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
Attachments
testcolor.pdf
(42.32 KiB) Downloaded 91 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Digital Sig placed fails on color document

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

Have you tried signing that document manually via the End-User Editor?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Digital Sig placed fails on color document

Post by prime clinical systems »

Hi Alex, please this has to work in code, the above works fine on monochrome and grey-scale, so please investigate, thanks
attached the same document converted to b/w and greyscale so you can see the issue.
Attachments
testBW.pdf
(90.64 KiB) Downloaded 95 times
testGS.pdf
(209.18 KiB) Downloaded 92 times
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Digital Sig placed fails on color document

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

That's not the case - there is no point of trying that via code when this does not work like intended in the End-User Editor. That's why I asked you to check this scenario manually and see whether the problem persists. If not - then we can take a deeper look into the code and why it's happening. If the problem does reoccur in the End-User Editor, then we'll forward this to the appropriate developer and this will be fixed from our side.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Digital Sig placed fails on color document

Post by prime clinical systems »

Problem is Alex you can't replicate the actions of the code in the end user editor, as in editor you are first physically placing a signature box and pops up UI to select certificate etc, and in that case it does work, but does NOT work in code. I will pay extra to have someone test this if need be, just tell me how. Thanks
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Digital Sig placed fails on color document

Post by prime clinical systems »

I also tried this method
Call Me.PDF.Doc.CoreDoc.AcroForm.Document.DeferedDigitalSignFieldPFX("C:\Users\Public\" & Userinit & "\" & Userinit & ".pfx", Password, FField, Sign_GR_Image, "Approve", "Work", Phone, TempSigPath)

Works on b/w and greyscale, does not work on color either.
CE
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Digital Sig placed fails on color document

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

Tomorrow I will be at work so I will try to look at the problem and will tell you the results of the investigation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Digital Sig placed fails on color document  SOLVED

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

Just tested the behavior - signed all of the files with or without FieldName specified by using your code in FullDemo application. Everything worked correctly.
Here's the code that you can try for yourself:

Code: Select all

int nID = pdfCtl.Inst.Str2ID("op.document.addDigitalSignature", false);
PDFXEdit.IOperation Op = pdfCtl.Inst.CreateOp(nID);
PDFXEdit.ICabNode input = Op.Params.Root["Input"];
input.Add().v = pdfCtl.Doc;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
options["FieldName"].v = "Signature1"; //this can be commented so that the signature will be added on the page itself
options["DocMDP"].v = 3;
options["DigiSigType"].v = 1;
options["FileCertificate"].v = @"D:\111111.pfx";
options["UseFileCertificate"].v = true;
options["CertificatePassword"].v = "111111";
options["AskDestinationFileName"].v = false;
options["DestinationFileName"].v = @"F:\testcolor_signed.pdf";
PDFXEdit.ICabNode appear = options["SignatureAppearance"];
appear["HasTemplate"].v = true;
PDFXEdit.ICabNode tmplt = appear["Template"];
tmplt["GraphicType"].v = 2;
tmplt["GraphicName"].v = @"D:\sig.bmp";
tmplt["TextDirection"].v = 0;
tmplt["ShowName"].v = true;
tmplt["ShowDate"].v = true;
tmplt["ShowLabels"].v = true;
tmplt["ShowLogo"].v = true;
Op.Do();
PDFXEdit.IPXC_Document doc = (PDFXEdit.IPXC_Document)Op.Params.Root["Output"][0].v;
pdfCtl.OpenDocFrom(doc);
Maybe the size of the field that you have specified is too small to see the signature?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Digital Sig placed fails on color document

Post by prime clinical systems »

ok thanks for trying, just does not work, must be vb6 isssue, one thing I noticed is that their is no defined colorspace for the page, and when I try other color documents that do have a colorspace, it does work. Seems its the html to pdf convertor I use to create the page I sent you that does not define the colorspace for the page that is the issue.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Digital Sig placed fails on color document

Post by Sasha - Tracker Dev Team »

Hello prime clinical systems,

Well, sadly, we can't do much here from our side.

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