Skip to content

Instantly share code, notes, and snippets.

How to Sign PDF Document with Barcode signature in C#. For more information, please follow link: https://kb.conholdate.com/total/net/how-to-sign-pdf-document-with-barcode-signature-in-csharp
using System;
using GroupDocs.Signature;
using GroupDocs.Signature.Domain;
using GroupDocs.Signature.Options;
namespace SignPdfDocumentWithBarcodeInCSharp
{
class Program
{
public static void Main(string[] args) // Main function to Sign PDF with Barcode signature using C#
{
// Remove the watermark in output PDF document by adding license
string licensePath = "/path/to/GroupDocs.Signature.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// load the source PDF for sign with Barcode signature
Signature signature = new Signature("/path/to/sample.pdf");
// create Barcode options with predefined Barcode text
BarcodeSignOptions options = new BarcodeSignOptions("JohnSmith")
{
// setup Barcode encoding type
EncodeType = BarcodeTypes.Code128,
// set signature position
Left = 50,
Top = 150,
Width = 200,
Height = 200
};
// sign document to file
SignResult result = signature.Sign("/path/to/signed.pdf", options);
Console.WriteLine("Done");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment