Debenu Quick PDF Library lets you add visual digital signatures to PDF files programmatically with a few simple lines of code. It lets you sign existing signature form fields or will automatically create a signature form field with the name that you specify as part of the signing process.

Here is some C# and Delphi sample code which demonstrates how to sign a PDF file with a visual signature.

Delphi

DPL.DrawText(100, 700, 'This is the file to be signed');
DPL.SaveToFile('TheUnsignedFile.pdf');
 
SignProcessID := DPL.NewSignProcessFromFile('TheUnsignedFile.pdf', ''); // Add an Integer var for SignProcessID
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');
  DPL.ReleaseSignProcess(SignProcessID); // Releases a signature process from memory
end;

SignProcessID := DPL.NewSignProcessFromFile('TheUnsignedFile.pdf', ''); // Add an Integer var for SignProcessID
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');
DPL.ReleaseSignProcess(SignProcessID); // Releases a signature process from memory
end;

C#

DPL.DrawText(100, 700, "This is the file to be signed");
DPL.SaveToFile("TheUnsignedFile.pdf");
 
int SignProcessID = DPL.NewSignProcessFromFile("TheUnsignedFile.pdf", ""); // Add an Integer var for SignProcessID
if (SignProcessID > 0)
{
  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");
  DPL.ReleaseSignProcess(SignProcessID); // Releases a signature process from memory
}

int SignProcessID = DPL.NewSignProcessFromFile("TheUnsignedFile.pdf", ""); // Add an Integer var for SignProcessID
if (SignProcessID > 0)
{
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");
DPL.ReleaseSignProcess(SignProcessID); // Releases a signature process from memory
}

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

Debenu Quick PDF Library also lets you add document level digital signatures, signatures that are not visible on the page, to PDF files using the SignFile function.