Obtain document form fields and signatures information
Leave feedback
GroupDocs.Signature allows to get extended document information which includes:
- list of all existing Form Field Signatures in the document. This list will contain all Form Fields elements in the document no matter if these components were added by GroupDocs Signature or any other third party software. Please be aware only Pdf and Word processing documents support these elements.
- list of Text Signatures previously added to document over Sign method or updated by Update method;
- list of Image Signatures previously added to document over Sign method or updated by Update method;
- list of DigitalSignature previously added to document over Sign method or updated by Update method;
- list of BarcodeSignature previously added to document over Sign method or updated by Update method;
- list of QrCodeSignature previously added to document over Sign method or updated by Update method;
- list of FormFieldSignature previously added to document over Sign method or updated by Update method;
- list of MetadataSignature previously added to document over Sign method or updated by Update method;
The following code snippet demonstrates how to obtain information about document form fields, signatures and analyze them.
using (Signature signature = new Signature("sampleSigned.pdf"))
{
IDocumentInfo documentInfo = signature.GetDocumentInfo();
Console.WriteLine($"Document properties {Path.GetFileName(filePath)}:");
Console.WriteLine($" - format : {documentInfo.FileType.FileFormat}");
Console.WriteLine($" - extension : {documentInfo.FileType.Extension}");
Console.WriteLine($" - size : {documentInfo.Size}");
Console.WriteLine($" - page count : {documentInfo.PageCount}");
foreach (PageInfo pageInfo in documentInfo.Pages)
{
Console.WriteLine($" - page-{pageInfo.PageNumber} Width {pageInfo.Width}, Height {pageInfo.Height}");
}
// display document Form Field signatures information
Console.WriteLine($"Document Form Fields information: count = {documentInfo.FormFields.Count}");
foreach (FormFieldSignature formField in documentInfo.FormFields)
{
Console.WriteLine($" - type #{formField.Type}: Name: {formField.Name} Value: {formField.Value}");
}
// display document Text signatures information
Console.WriteLine($"Document Text signatures : {documentInfo.TextSignatures.Count}");
foreach (TextSignature textSignature in documentInfo.TextSignatures)
{
Console.WriteLine($" - #{textSignature.SignatureId}: Text: {textSignature.Text}");
}
// display document Image signatures information
Console.WriteLine($"Document Image signatures : {documentInfo.ImageSignatures.Count}");
foreach (ImageSignature imageSignature in documentInfo.ImageSignatures)
{
Console.WriteLine($" - #{imageSignature.SignatureId}: Size: {imageSignature.Size} bytes, Format: {imageSignature.Format}.");
}
// display document Digital signatures information
Console.WriteLine($"Document Digital signatures : {documentInfo.DigitalSignatures.Count}");
foreach (DigitalSignature digitalSignature in documentInfo.DigitalSignatures)
{
Console.WriteLine($" - #{digitalSignature.SignatureId}.");
}
// display document Barcode signatures information
Console.WriteLine($"Document Barcode signatures : {documentInfo.BarcodeSignatures.Count}");
foreach (BarcodeSignature barcodeSignature in documentInfo.BarcodeSignatures)
{
Console.WriteLine($" - #{barcodeSignature.SignatureId}: Type: {barcodeSignature.EncodeType?.TypeName}. Text: {barcodeSignature.Text}");
}
// display document QrCode signatures information
Console.WriteLine($"Document QR-Code signatures : {documentInfo.QrCodeSignatures.Count}");
foreach (QrCodeSignature qrCodeSignature in documentInfo.QrCodeSignatures)
{
Console.WriteLine($" - #{qrCodeSignature.SignatureId}: Type: {qrCodeSignature.EncodeType?.TypeName}. Text: {qrCodeSignature.Text}");
}
// display document Form Fields signatures information
Console.WriteLine($"Document Form Fields signatures : {documentInfo.FormFieldSignatures.Count}");
foreach (FormFieldSignature formFieldSignature in documentInfo.FormFields)
{
Console.WriteLine($" - #{formFieldSignature.SignatureId} Type {formFieldSignature.Type}: Name: {formFieldSignature.Name} Value: {formFieldSignature.Value}");
}
// display document Metadata signatures information
Console.WriteLine($"Document Metadata signatures : {documentInfo.MetadataSignatures.Count}");
foreach (MetadataSignature metadataSignature in documentInfo.MetadataSignatures)
{
Console.WriteLine($" - #{metadataSignature.Name} = {metadataSignature.Value}.Type:{metadataSignature.Type}");
}
}
You may easily run the code above and see the feature in action in ourΒ GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Along with the full-featured .NET library, we provide simple but powerful free online apps.
To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.