Skip to content

Instantly share code, notes, and snippets.

@SumindaD
Created December 3, 2019 10:55
Show Gist options
  • Save SumindaD/bd419a2b8b6657cb5238108ade681ee5 to your computer and use it in GitHub Desktop.
Save SumindaD/bd419a2b8b6657cb5238108ade681ee5 to your computer and use it in GitHub Desktop.
using GemBox.Pdf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SignPDF
{
class Program
{
static void Main(string[] args)
{
// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = PdfDocument.Load("Test.pdf"))
{
// Add an invisible signature field to the PDF document.
var signatureField = document.Form.Fields.AddSignature();
// Initiate signing of a PDF file with the specified digital ID file and the password.
signatureField.Sign("PrivateKeyCert.pfx", "1234");
// Finish signing of a PDF file.
document.Save("SignedDocument.pdf");
}
Console.WriteLine("Signed!");
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment