[]
SignToolSettings:
object
Appearance settings for the Signature Tool dialog.
optional
afterAdd: (result
) =>void
The afterAdd event handler will be called when the result annotation is added and signature dialog is closed.
number
void
var viewer = new DsPdfViewer("#root");
viewer.options.signTool = {
afterAdd: function() {
// Put your code here.
return true;
},
};
// Update the title of the result annotation and convert the annotation to content:
var viewer = new DsPdfViewer(selector, {
supportApi: {
apiUrl: 'http://127.0.0.1:5001/support-api/gc-pdf-viewer',
webSocketUrl: false
},
signTool: {
afterAdd: function(result) {
var annotation = result.annotation;
annotation.title = 'New Title';
annotation.convertToContent = true;
viewer.updateAnnotation(result.pageIndex, annotation);
return true;
}
}
});
optional
afterShow: (signatureDialog
) =>void
The afterShow event handler will be called after the dialog is shown.
any
void
var viewer = new DsPdfViewer("#root");
viewer.options.signTool = {
afterShow: function() {
alert('The dialog is shown.');
},
};
optional
autoResizeCanvas:boolean
Automatically adjust the canvas size so that it shrinks to fit the window when the window size is small.
true;
optional
beforeAdd: (activeTool
,signatureDialog
) =>boolean
The beforeAdd event handler will be called when the Add button is clicked. Return false if you want to cancel default add action.
any
any
boolean
var viewer = new DsPdfViewer("#root");
viewer.options.signTool = {
beforeAdd: function() {
// Put your code here.
return true;
},
};
optional
beforeHide: (signatureDialog
) =>boolean
The beforeHide event handler will be called before the dialog is closed. Return false if you want to to prevent the dialog from closing.
any
boolean
viewer.options.signTool = {
subject: "subject1",
beforeHide: function (dialog) {
// You can execute any custom code when the dialog is about to hide:
console.log("dialog subject is " + dialog.subject);
}
};
var viewer = new DsPdfViewer("#root");
viewer.options.signTool = {
beforeHide: function() {
// Return false to prevent the dialog from closing:
return false;
},
};
optional
beforeShow: (signatureDialog
) =>boolean
The beforeShow event handler will be called before the dialog is shown. Return false if you want to prevent the dialog from showing.
any
boolean
var viewer = new DsPdfViewer("#root");
viewer.options.signTool = {
beforeShow: function() {
// Return false to cancel showing the dialog:
return false;
},
};
optional
bold:boolean
Bold text style for the "Type" tab.
false
optional
canvasSize:object
The size of the canvas in pixels.
{width: 500; height: 200}
height:
number
width:
number
optional
convertToContent:boolean
Convert the result stamp to content.
false
var viewer = new DsPdfViewer("#root", signTool: { convertToContent: true });
optional
destinationScale:number
The target value for the canvas scale. The result annotation bounds will be scaled using this value. For example, if destinationScale is 0.5 and canvasSize is 400/200, the size of the result annotation will be 200/100.
0.5
optional
dialogLocation:"Center"
|"Top"
|"Right"
|"Bottom"
|"Left"
| {x
:number
;y
:number
; }
Dialog location within window rectangle. Origin is top/left.
'Center'
optional
fontName:string
The default font name that will be used for the "Type" tab.
'Brush Script MT'
optional
fontNames:string
[]
Array of the available font names.
['Arial', 'Verdana', 'Helvetica', 'Tahoma', 'Trebuchet MS', 'Times New Roman', 'Georgia', 'Garamond', 'Courier New', 'Brush Script MT']
optional
fontSize:number
The default font size that will be used for the "Type" tab.
48
optional
hasImage:boolean
If true, the signature tool will try to load an image from local storage for the Image tab.
false
// Create the viewer:
var viewer = new DsPdfViewer({ userName: 'John', signTool: { hasImage: true, saveSignature: true, selectedTab: 'Image', tabs: ['Image'] } });
// save image for use with Image tab:
viewer.signToolStorage.saveImage('Image', document.querySelector('img'));
optional
hideDialogFooter:boolean
Specifies whether to hide dialog footer.
false
optional
hideDialogTitle:boolean
Specifies whether to hide dialog title.
false
optional
hideSaveSignature:boolean
Specifies whether to hide the "Save signature" button.
false
optional
hideTabs:boolean
Specifies whether to hide tab buttons.
false
optional
hideToolbar:boolean
Specifies whether to hide the toolbar which can be used to customize typing and drawing styles.
false
optional
italic:boolean
Italic text style for the "Type" tab.
true
optional
location:"Center"
|"Top"
|"Right"
|"Bottom"
|"Left"
|"TopLeft"
|"TopRight"
|"BottomRight"
|"BottomLeft"
| {x
:number
;y
:number
; }
The result location of the annotation on the page. Note, when you specify the exact location (using {x, y} values), the origin is at the bottom left corner.
'BottomRight'
optional
pageIndex:number
Destination page index.
The default is the visible page index.
optional
penColor:string
Pen color.
#000000
options.signTool = {
penColor: '#00ff00'
};
optional
penWidth:number
Pen width.
2
optional
ruler: {Draw
:RulerLine
[] |false
;Image
:RulerLine
[] |false
;Type
:RulerLine
[] |false
; } |false
Canvas ruler lines customization.
{ Draw
: RulerLine
[] | false
; Image
: RulerLine
[] | false
; Type
: RulerLine
[] | false
; }
false
// Hide all ruler lines:
viewer.options.signTool = { ruler: false };
// Hide the ruler for the Draw tab:
viewer.options.signTool = { ruler: { Draw: false } };
// Define a custom ruler lines for the Draw tab:
viewer.options.signTool = {
ruler: {
Draw: [{ color: "#ff0000", size: 5, type: "dashed", position: 50 },
{ color: "#ff00ff", size: 2, type: "solid", position: 80 }]
}
};
optional
saveSignature:boolean
Indicates whether the signature data must be saved into browser's local storage for later use. The saved data is owned by the active user, which can be set using the currentUserName property.
false
optional
selectedTab:"Type"
|"Draw"
|"Image"
Initially selected tab.
Default is 'Draw'
var viewer = new DsPdfViewer("#host", {
signTool: { selectedTab: 'Type' }
});
optional
subject:string
Result annotation subject.
empty string
optional
tabs: ("Type"
|"Draw"
|"Image"
)[]
Array of the available tabs. The order of the tabs is preserved. Possible values are: 'Type', 'Draw', 'Image'.
['Type', 'Draw', 'Image']
optional
text:string
The default text that will be used for the "Type" tab.
optional
textColor:string
Text color.
#000000
options.signTool = {
textColor: '#00ff00'
};
optional
title:string
Dialog title.
'Add Signature'
options.signTool = {
title: 'Signature'
};