Analyze SignResult result to check newly created signatures if needed.
This example shows how to add Barcode signature to document. See SignResult.
using(Signaturesignature=newSignature("sample.docx")){// create barcode option with predefined barcode textBarcodeSignOptionsoptions=newBarcodeSignOptions("12345678"){// setup Barcode encoding typeEncodeType=BarcodeTypes.Code128,// set signature positionLeft=100,Top=100,// set signature alignment// when VerticalAlignment is set the Top coordinate will be ignored.// Use Margin properties Top, Bottom to provide vertical offsetVerticalAlignment=Domain.VerticalAlignment.Top,// when HorizontalAlignment is set the Left coordinate will be ignored.// Use Margin properties Left, Right to provide horizontal offsetHorizontalAlignment=Domain.HorizontalAlignment.Right,Margin=newPadding(){Top=20,Right=20},// adjust signature appearance// setup signature borderBorder=newBorder(){Color=Color.DarkGreen,DashStyle=DashStyle.DashLongDashDot,Transparency=0.5,Visible=true,Weight=2},// set text color and FontForeColor=Color.Red,Font=newSignatureFont{Size=12,FamilyName="Comic Sans MS"},// specify position of text with barcode lineCodeTextAlignment=CodeTextAlignment.Above,// setup backgroundBackground=newBackground(){Color=Color.LimeGreen,Transparency=0.5,Brush=newLinearGradientBrush(Color.LimeGreen,Color.DarkGreen)}};// sign document to fileSignResultsignResult=signature.Sign("SampleSigned.docx",options);// analyzing resultConsole.WriteLine("List of newly created signatures:");intnumber=1;foreach(BaseSignaturetempinsignResult.Succeeded){Console.WriteLine($"Signature #{number++}: Type: {temp.SignatureType} Id:{temp.SignatureId}, Location: {temp.Left}x{temp.Top}. Size: {temp.Width}x{temp.Height}");}}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: