Created
July 9, 2019 05:54
-
-
Save GroupDocsGists/785b50d976c0295dbcf75537d76f9c1d 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
// For complete examples and data files, please go to https://github.com/groupdocs-signature/GroupDocs.Signature-for-.NET | |
// setup Signature configuration | |
SignatureConfig signConfig = new SignatureConfig | |
{ | |
StoragePath = @"c:\GroupDocs\Storage", | |
OutputPath = @"c:\GroupDocs\Output" | |
}; | |
// instantiate the signature handler | |
SignatureHandler handler = new SignatureHandler(signConfig); | |
// setup key and passphrase | |
string key = "1234567890"; | |
string salt = "1234567890"; | |
// create data encryption | |
IDataEncryption encryption = new SymmetricEncryption(SymmetricAlgorithmType.Rijndael, key, salt); | |
// setup options with text of signature | |
ImagesMetadataSignOptions signOptions = new ImagesMetadataSignOptions(); | |
// create custom object | |
DocumentSignature signature = new DocumentSignature() | |
{ | |
ID = Guid.NewGuid().ToString(), | |
Author = Environment.UserName, | |
Signed = DateTime.Now, | |
DataFactor = 11.22M | |
}; | |
ushort imgsMetadataId = 41996; | |
// add custom object to the sigature collection | |
ImageMetadataSignature mdDocument = signOptions.AddSignature(imgsMetadataId, signature); | |
// set encryption | |
mdDocument.DataEncryption = encryption; | |
// sign document | |
string signedPath = handler.Sign<string>(@"sample.jpg", signOptions, | |
new SaveOptions { OutputType = OutputType.String, OutputFileName = "SignedImage.jpg" }); | |
Console.WriteLine("Signed file's path is: " + signedPath); |
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
// For complete examples and data files, please go to https://github.com/groupdocs-signature/GroupDocs.Signature-for-.NET | |
// setup configuration | |
SignatureConfig signConfig = new SignatureConfig | |
{ | |
StoragePath = @"c:\GroupDocs\Storage", | |
OutputPath = @"c:\GroupDocs\Output" | |
}; | |
// instantiate the signature handler | |
SignatureHandler handler = new SignatureHandler(signConfig); | |
// setup search options | |
PdfSearchQRCodeOptions searchOptions = new PdfSearchQRCodeOptions(); | |
// specify as true to search all pages of a document | |
searchOptions.SearchAllPages = true; | |
// search document | |
SearchResult result = handler.Search("SignedQRCode.pdf", searchOptions); | |
// output signatures | |
List<QRCodeSignature> signatures = result.ToList<QRCodeSignature>(); | |
foreach (QRCodeSignature signature in signatures) | |
{ | |
Console.WriteLine("Found QRCode signature: {0} with text {1} on page {2}", signature.EncodeType.TypeName, signature.Text, signature.PageNumber); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment