Print Page | Close Window

Can't signing a signature field

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3896
Printed Date: 26 Apr 24 at 2:24AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Can't signing a signature field
Posted By: Adia
Subject: Can't signing a signature field
Date Posted: 16 Feb 21 at 9:20AM
Hi
I am trying to sign document using PFX file.
in the document I already have a signature filed name "Sig" -  code snip:

int signProcessID = debenu.NewSignProcessFromFile(fileName, "");
int res = debenu.SelectPage(1);          
res = debenu.SetSignProcessField(signProcessID, "Sig");          
res = debenu.SetSignProcessFieldImageFromFile(signProcessID,  Path.Combine(Directory.GetCurrentDirectory(), $"SigImage.jpg"), 0);
res = debenu.SetNeedAppearances(0);
res = debenu.SetSignProcessSubFilter(signProcessID, 3);         
res = debenu.SetSignProcessInfo(signProcessID, "To test digital signatures", "The World", "Contact me");
res = debenu.SetSignProcessPFXFromFile(signProcessID, GetPFXFileName(), "123456");
res = debenu.EndSignProcessToFile(signProcessID, Path.Combine(Directory.GetCurrentDirectory(), $"{Guid.NewGuid().ToString().Substring(0, 5)}.pdf"));
res = debenu.GetSignProcessResult(signProcessID);
res = debenu.ReleaseSignProcess(signProcessID);

I  getting code 13 from GetSignProcessResult 

Please Advice 




 



Replies:
Posted By: tfrost
Date Posted: 16 Feb 21 at 10:27AM
First, I suggest not discarding all the res values; check each one.  And also I would recommend moving your SetNeedAppearances to precede the NewSignProcess call.


Posted By: Adia
Date Posted: 16 Feb 21 at 10:42AM
Thanks for your replay.

I Am checking the res value in debug.
SetNeedAppearances, SetSignProcessFieldall, SetSignProcessFieldImageFromFile,SetSignProcessSubFilter, SetSignProcessInfo,SetSignProcessPFXFromFile return 1.
EndSignProcessToFile return 0.
GetSignProcessResult return 13.

I moved the SetNeedAppearances precede to the NewSignProcessFromFile call
but I getting the same result - 13.







Posted By: Ingo
Date Posted: 16 Feb 21 at 10:27PM
Regarding SetNeedApp... you can read this in the documentation:
"...
Most PDF viewers will create the appearance stream for all form fields when the document is opened
..."
This isn't correct behavior if you want to sign a document.
It should be firmed and unchanged.
So try SetNeeApp... with 0 or -1 and it should work as expected.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk