Form Designer Toolbar Customization in JavaScript
30 Oct 20254 minutes to read
The form designer toolbar can be customized by showing or hiding default items and by controlling the order in which the items appear.
Show or hide the form designer toolbar
Show or hide the form designer toolbar programmatically during initialization or at runtime.
Use the EnableFormDesigner property or the showFormDesignerToolbar method to toggle visibility.
The following code snippet explains how to show or hide the toolbar using the EnableFormDesigner property.
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.Navigation,
ej.pdfviewer.Annotation, ej.pdfviewer.LinkAnnotation, ej.pdfviewer.ThumbnailView, ej.pdfviewer.BookmarkView,
ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.FormFields, ej.pdfviewer.FormDesigner
);
var pdfviewer = new ej.pdfviewer.PdfViewer({
enableFormDesigner: false,
documentPath: 'https://cdn.syncfusion.com/content/pdf/formdesigner.pdf',
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib'
});
pdfviewer.appendTo('#PdfViewer');<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 2</title>
<!-- Essential JS 2 tailwind3 theme -->
<link href="https://cdn.syncfusion.com/ej2/31.2.2/tailwind3.css" rel="stylesheet" type="text/css"/>
<!-- Essential JS 2 PDF Viewer's global script -->
<script src="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2.min.js" type="text/javascript"></script>
</head>
<body>
<div id='container'>
<div id='PdfViewer' style="height:500px;width:100%;">
</div>
</div>
</body>
</html>How to customize the form designer toolbar
Choose which tools appear and control their order in the form designer toolbar.
Use PdfViewerToolbarSettings with the FormDesignerToolbarItems property to choose which form design tools are available. The property accepts a list of FormDesignerToolbarItem values. The items you include are both displayed and rendered in the order listed; any items you omit are hidden. This provides a streamlined, user-friendly form design experience across devices.
The following example demonstrates how to customize the form designer toolbar by configuring specific tools using FormDesignerToolbarItem.
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.Navigation,
ej.pdfviewer.Annotation, ej.pdfviewer.LinkAnnotation, ej.pdfviewer.ThumbnailView,
ej.pdfviewer.BookmarkView, ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch,
ej.pdfviewer.FormFields, ej.pdfviewer.FormDesigner);
var pdfviewer = new ej.pdfviewer.PdfViewer({
documentPath: 'https://cdn.syncfusion.com/content/pdf/formdesigner.pdf',
resourceUrl: 'https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib'
});
pdfviewer.toolbarSettings = {
formDesignerToolbarItems: [
"TextboxTool",
"PasswordTool",
"CheckBoxTool",
"RadioButtonTool",
"DropdownTool",
"ListboxTool",
"DrawSignatureTool",
"DeleteTool"
]
};
pdfviewer.appendTo('#PdfViewer');<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 2</title>
<!-- Essential JS 2 tailwind3 theme -->
<link href="https://cdn.syncfusion.com/ej2/31.2.2/tailwind3.css" rel="stylesheet" type="text/css"/>
<!-- Essential JS 2 PDF Viewer's global script -->
<script src="https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2.min.js" type="text/javascript"></script>
</head>
<body>
<div id='container'>
<div id='PdfViewer' style="height:500px;width:100%;">
</div>
</div>
</body>
</html>