Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Visible digital signature
  FAQ FAQ  Forum Search   Register Register  Login Login

Visible digital signature

 Post Reply Post Reply
Author
Message
struhadlo View Drop Down
Beginner
Beginner


Joined: 07 Mar 13
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote struhadlo Quote  Post ReplyReply Direct Link To This Post Topic: Visible digital signature
    Posted: 12 Mar 13 at 11:53AM
Hi,

I downloaded trial version and want to make visible digital signature. Can somebody please help me how can i make visible signature? Is it possible to make visible digital signature with Debenu Quick PDF Library?

I use Delphi 7 with DebenuQuickPDFLibrary0913 on WindowsXP.

The code, which i tried, open input pdf file, then create FormField with SetSignProcessField command (from manual: The created field will be invisible (zero width and height) and will be attached to the first page in the document.), but don't return its ID. When i want to find it by its name, function FindFormFieldByTitle returns 0 (The form field could not be found.)
How can i use function SetFormFieldSignatureImage, when i need to pass it signature form field? I tried make newFormField, but it didn't reach the desired result (maybe i did some mistake).

Thanks for any advice
Petr Gabriel

const
FORMFIELD_NAME = 'DIGITAL_SIGNATURE';
var
PDFLibrary: TDebenuPDFLibrary0913;
UnlockResult: Integer;
SignProcessID: Integer;
ImageID: Integer;
FormFieldIndex: Integer;
begin
PDFLibrary:= TDebenuPDFLibrary0913.Create();
try
    UnlockResult:= PDFLibrary.UnlockKey(MY_UNLOCK_KEY);
    if UnlockResult = 1 then begin
      SignProcessID:= PDFLibrary.NewSignProcessFromFile('c:\home\input.pdf', '');
      if SignProcessID = 0 then begin
        MessageDlg('Error: NewSignProcessFromFile', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SetSignProcessField(SignProcessID, FORMFIELD_NAME) = 0 then begin
        MessageDlg('Error: SetSignProcessField', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      MessageDlg('FormFieldCount: ' + IntToStr(PDFLibrary.FormFieldCount()),
                  Dialogs.mtInformation, [Dialogs.mbOK], 0);
      FormFieldIndex:= PDFLibrary.FindFormFieldByTitle(FORMFIELD_NAME);
      if FormFieldIndex = 0 then begin
        MessageDlg('Error: FindFormFieldByTitle', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SetFormFieldVisible(FormFieldIndex, 1) = 0 then begin
        MessageDlg('Error: SetFormFieldVisible', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SetFormFieldBounds(FormFieldIndex, 25, 500, 100, 100) = 0 then begin
        MessageDlg('Error: SetFormFieldBounds', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      ImageID:= PDFLibrary.AddImageFromFile('C:\home\logo.gif', 0);
      if ImageID = 0 then begin
        MessageDlg('Error: AddImageFromFile', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SelectImage(ImageID) = 0 then begin
        MessageDlg('Error: SelectImage', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SetFormFieldSignatureImage(FormFieldIndex, PDFLibrary.SelectedImage(), 0) = 0 then begin
        MessageDlg('Error: SetFormFieldSignatureImage', Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      if PDFLibrary.SetSignProcessInfo(SignProcessID, 'Reason: Test', 'Location: CZ', 'Contact: PhoneNumber') = 0 then begin
        MessageDlg(Error: SetSignProcessInfo, Dialogs.mtError, [Dialogs.mbOk], 0);
        Exit;
      end;
      if PDFLibrary.SetSignProcessPFXFromFile(SignProcessID, 'c:\home\cacert\cacert.p12', MY_CERT_PASSWORD) = 0 then begin
        MessageDlg(Error: SetSignProcessPFXFromFile, Dialogs.mtError, [Dialogs.mbOK], 0);
        Exit;
      end;
      PDFLibrary.EndSignProcessToFile(SignProcessID, 'c:\home\output.pdf');
    end
    else
      MessageDlg('Invalid lincese key', Dialogs.mtError, [Dialogs.mbOK], 0);
finally
    PDFLibrary.Free();
end;
end;
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Mar 13 at 10:18PM
Hi!

Andrew hat shown in an earlier post how to "see" a digital signature:
http://www.quickpdf.org/forum/how-do-i-detect-that-a-pdf-has-a-digital-signature_topic2529_post10489.html?KW=FormFieldType#10489

Cheers and welcome here,
Ingo

Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 13 Mar 13 at 12:10AM
The simple answer is that you can not do this today.  Ingo has kindly provided a solution for a question you did not ask, about detecting whether a PDF is signed.

Nothing I have tried has enabled me to create a standard, functioning, visible signature field with Debenu, which looks like those you can make with Acrobat or Nitro Pro.  I have used both 9.12 and 9.13 and I have two outstanding support cases on this issue, but no solution.  I urge you to open a fresh support issue in the hope that you may have better luck.

Back in December (18/12/2012) I had a response from Andrew saying "We are currently working on the beefing up the SignFile functionality with new functions and features.  When this is finished we will be documenting all the new features and will have sample code showing how to use the new functions".  This would be great if if had happened, but no sign of it after nearly three months.  If functions were available and working to do what both you and I need, I cannot see how it could possibly take so long to produce a simple example of how to do it, which is what I requested.  Hence the conclusion in my first sentence.
Back to Top
struhadlo View Drop Down
Beginner
Beginner


Joined: 07 Mar 13
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote struhadlo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Mar 13 at 1:57PM
Thanks you for reply. So I can only wait for new information/version.
Back to Top
kevindebenu View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 16 Apr 12
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevindebenu Quote  Post ReplyReply Direct Link To This Post Posted: 17 Mar 13 at 2:09PM
struhadlo and tfrost,

Debenu Quick PDF Library 9.14 will include two new functions:
SetSignProcessFieldImageFromFile
SetSignProcessFieldBounds

These will allow the creation of a digital signature with an appearance stream containing the specified image.

Look out for the first beta of 9.14 due out soon.

-Kevin
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 19 Mar 13 at 8:11AM
Hi Guys,

Debenu Quick PDF Library 9.14 Beta 1 has been released and can be downloaded from the Debenu Blog.

Here is some Delphi sample code that demonstrates how to use the new visual digital signature feature:

------------------------------------------------
procedure TForm7.btnNewSignProcessFromFileClick(Sender: TObject);
var
SignProcessID: Integer;
begin
    DPL := TDebenuPDFLibrary0914.Create;
    if DPL.UnlockKey('..license_key_goes_here') = 1 then
    begin
      DPL.DrawText(100, 700, 'This is the file to be signed');
      DPL.SaveToFile('TheUnsignedFile.pdf');

      SignProcessID := DPL.NewSignProcessFromFile('TheUnsignedFile.pdf', '');
      if (SignProcessID > 0) then
      begin
        DPL.SetSignProcessPFXFromFile(SignProcessID, 'qpl_test.pfx', 'testing');
        DPL.SetSignProcessInfo(SignProcessID, 'To test digital signatures', 'The World', 'Contact me');
        DPL.SetSignProcessField(SignProcessID, 'Contract Signature');
        DPL.SetSignProcessFieldBounds(SignProcessID, 100, 600, 200, 100);
        DPL.SetSignProcessFieldImageFromFile(SignProcessID, 'visualsignature.jpg', 0);
        DPL.EndSignProcessToFile(SignProcessID, 'TheSignedFile.pdf');
      end;
    end;
end;
------------------------------------------------

If you experience any issues with this please let us know.

Cheers,
- Rowan.
Back to Top
Chumly View Drop Down
Beginner
Beginner


Joined: 05 Aug 12
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Chumly Quote  Post ReplyReply Direct Link To This Post Posted: 28 Apr 13 at 6:04AM
Hi,
I'm having troubles getting this to work in asp using the ActiveX module...
Result all come back as '1' until the EndSignProcessToFile which returns '0'. But that does not tell me why.

Using the second method, (SignFile) it returns '7' which says it has the wrong password.
However, the same data works fine using jSignPDF.
Can you help me understand what the requirements of the pfx file is that will allow me to get rid of jsignpdf?
Code in use:
     SigProcID = QP.NewSignProcessFromFile(FilePath,OpenPassword)
     result = QP.SetSignProcessInfo(SigProcID,Reason,Location,ContactInfo)
     response.write "Result: "& result & "<br>" & vbCrLf
     result = QP.SetSignProcessField(SigProcID,"DigitalSignature")
     response.write "Result: "& result & "<br>" & vbCrLf
     result = QP.SetSignProcessFieldBounds(SigProcID, 100, 600, 200, 100)
     response.write "Result: "& result & "<br>" & vbCrLf
    result = QP.SetSignProcessFieldImageFromFile(SigProcID, SigImageFile, 0)
     response.write "Result: "& result & "<br>" & vbCrLf
     result = QP.SetSignProcessPFXFromFile(SigProcID,PFXFileName,PFXPassword)
     response.write "Result: "& result & "<br>" & vbCrLf
     result = QP.EndSignProcessToFile(SigProcID, OutputFileName)
     response.write "Result: "& result & ", Path: " & OutputFileName & "<br>" & vbCrLf

     result = QP.SignFile(FilePath, "", SignaturesFieldName, OutputFileName, PFXFileName, PFXPassword, Reason, Location, ContactInfo)
     response.write "Result: "& result & ", Path: " & OutPutFileName & "<br>" & vbCrLf


Output:
Saved: c:\inetpub\wwwroot\test\1367103662.pdf
Result: 1
Result: 1
Result: 1
Result: 1
Result: 1
Result: 0, Path: c:\inetpub\wwwroot\test\1367103662-signed.pdf
Result: 7, Path: c:\inetpub\wwwroot\test\1367103662-signed.pdf

Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 28 Apr 13 at 11:15AM
In my testing (of 9.14b4), the (undocumented) return code from the EndSignProcessToFile function is always zero whether or not the signature is valid, though no file is written if not.  I have a support ticket open and I know Debenu are working on the signatures for 9.14.  You do not need the SignFile as well as the EndSignProcessToFile.
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 18 Nov 13 at 12:46AM
Hi Guys,

The result returned by EndSignProcessToFile will always be zero. To check the result of the digital signature signing process call the GetSignProcessResult function.

The documentation has been updated to reflect this and the change will be in Debenu Quick PDF Library 10.12 Beta 2.

Cheers,
- Rowan.
Back to Top
tfrancois View Drop Down
Beginner
Beginner
Avatar

Joined: 14 Jul 15
Location: New York, NY
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrancois Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jul 15 at 6:18PM
Hello,

I am having the same issue with the incorrect password with a valid PFX and password.  What did you do to solve this issue?   I am at a complete loss.   I am considering purchasing the product, but with no indication that its working it may not make sense to make the investment.

Thanks,

Teddy.
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 17 Jul 15 at 3:13PM
This thread was about showing a visible signature block when a PDF is digitally signed.  If you are getting an error indicating an invalid password, that is something different: if the signature cannot be loaded, it clearly cannot be applied, with or without a visible presence.  Please show your actual code and the exact error return that you get, and someone may be able to help.
Back to Top
tfrancois View Drop Down
Beginner
Beginner
Avatar

Joined: 14 Jul 15
Location: New York, NY
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrancois Quote  Post ReplyReply Direct Link To This Post Posted: 17 Jul 15 at 4:41PM
Thank you for your reply.

I was able to solve the issue.  The PFX file was saved in the Computer's Personal certificate store so I had to use the SetSignProcessKeyset to 2 - Crypt Machine Keyset instead of leaving the default 1 - Crypt User Keyset set.

Once I made that change, it worked perfectly.  Hope this helps someone else.

Edited by tfrancois - 17 Jul 15 at 4:41PM
Back to Top
ixm7 View Drop Down
Senior Member
Senior Member


Joined: 13 Jan 06
Status: Offline
Points: 68
Post Options Post Options   Thanks (0) Thanks(0)   Quote ixm7 Quote  Post ReplyReply Direct Link To This Post Posted: 03 Oct 18 at 9:30PM
Instead of specifying a custom image file to fit into the digital signature form field, is there a way to generate the type of default Acrobat Digital Signature image generated by Acrobat digital signature?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store