Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using (Signature signature = new Signature("sample.pdf"))
{
    TextSignOptions options = new TextSignOptions("John Smith")
    {
        // locate signature
        Left = 100, Top = 100, Width = 100, Height = 30,
        // set text color and font
        ForeColor = Color.Red,
        Font = new SignatureFont { Size = 12, FamilyName = "Comic Sans MS" }
    };
    // sign document to file
    signature.Sign("signed.pdf", options);
}
// setup configuration
SignatureConfig signConfig = new SignatureConfig
{
    StoragePath = @"c:\Storage",
    OutputPath = @"c:\Output"
};
// instantiate the signature handler
SignatureHandler handler = new SignatureHandler(signConfig);
// setup text signature options
PdfSignTextOptions signOptions = new PdfSignTextOptions("John Smith")
{
    // locate signature
    Left = 100, Top = 100, Width = 100, Height = 30,
    // set text color and Ffont
    ForeColor = Color.Red,
    Font = new SignatureFont { FontSize = 12, FontFamily = "Comic Sans MS" }
};
SaveOptions saveOptions = new SaveOptions { OutputType = OutputType.String, OutputFileName = "signed.pdf" };
// sign document
string signedPath = handler.Sign<string>("test.pdf", signOptions,saveOptions);
Console.WriteLine("Signed file path is: " + signedPath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.