Locating signature on page with different measure units
Locating signature on page with different measure units
Leave feedback
GroupDocs.Signature supports locating signature on document page with different measure units. Enumeration MeasureType handles following types
MeasureType.Pixels allows to locate signature position and size with pixels (default value)
MeasureType.Millimeters allows to locate signature on page and setup size by setting millimeters
MeasureType.Percents allows to locate signature position, size with percentage of page size
Here are the steps to locate and size signature area with different measure unit types:
Set property LocationMeasureType with of one values above to specify how to implement values in properties Left, Top
Set property SizeMeasureType with of one values above to specify how to implement size of signature values in properties Width, Height
Set property MarginMeasureType with of one values above to specify how to implement values in property Margin
Set signature positioning in millimeters
This example shows how to specify positioning in millimeters.
using(Signaturesignature=newSignature("sample.docx")){// create barcode option with predefined barcode textBarcodeSignOptionsoptions=newBarcodeSignOptions("12345678"){// setup Barcode encoding typeEncodeType=BarcodeTypes.Code128,// set signature position in absolute positionLocationMeasureType=MeasureType.Millimeters,Left=40,Top=50,// set signature area in millimetersSizeMeasureType=MeasureType.Millimeters,Width=20,Height=10,// set margin in millimetersMarginMeasureType=MeasureType.Millimeters,Margin=newPadding(){Left=5,Top=5,Right=5},};// sign document to filesignature.Sign("signedSample.docx",options);}
Set signature positioning in percents
This example shows how to set different positioning properties in percentage.
using(Signaturesignature=newSignature("sample.pdf")){// create barcode option with predefined barcode textBarcodeSignOptionsoptions=newBarcodeSignOptions("12345678"){// setup Barcode encoding typeEncodeType=BarcodeTypes.Code128,// set signature position in absolute positionLocationMeasureType=MeasureType.Percents,Left=5,Top=5,// set signature area in millimetersSizeMeasureType=MeasureType.Percents,Width=10,Height=5,// set margin in millimetersMarginMeasureType=MeasureType.Percents,Margin=newPadding(){Left=1,Top=1,Right=1},};// sign document to filesignature.Sign("signed.docx",options);}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: