Created
August 29, 2019 11:41
-
-
Save GroupDocsGists/4a7557ad2b26d344f2fd97f3f0bd55d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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