Настройка параметров веб UI-контрола
В этом разделе
UI-элемент
WebUiControlJS и производные UI-элементы (
WebDocumentViewerJS,
WebPdfDocumentEditorControlJS,
WebSpreadsheetDocumentEditorControlJS,
WebDicomControlJS) позволяют определить DOM-элемент, который должен использоваться в качестве контейнера для UI-элемента (веб просмотрщик документов, веб редактор электронных таблиц, веб DICOM просмотрщик), а также позволяют определить коллекцию UI-элементов, которые представляют пользовательский интерфейс UI-элемента.
Вот JavaScript код, который демонстрирует как создать веб просмотрщик документов с настройками по умолчанию:
// create the default web document viewer settings
var docViewerSettings = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer");
// create the document viewer
var docViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
Вот JavaScript код, который демонстрирует как создать веб просмотрщик документов с поддержкой аннотаций:
// create the default web document viewer settings with annotations support
var docViewerSettings = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer", { annotations: true });
// create the document viewer
var docViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
При создании экземпляра класса
WebDocumentViewerJS функция
WebUiControlJS.get_Items позволяет получить коллекцию UI-элементов, которые по умолчанию содержатся в веб просмотрщике документов. Коллекцию UI-элементов можно изменить путем добавления, перемещения или удаления UI-элементов.
Вот JavaScript-код, который демонстрирует, как создать веб просмотрщик документов с поддержкой аннотаций и панелью аннотаций:
// create the default web document viewer settings with annotations support
var docViewerSettings = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerSettingsJS("documentViewerContainer", { annotations: true });
// create the document viewer
var docViewer = new Vintasoft.Imaging.DocumentViewer.WebDocumentViewerJS(docViewerSettings);
// get items of document viewer
var items = docViewerSettings.get_Items();
// get the main menu of document viewer
var mainMenu = items.getItemByRegisteredId("mainMenu");
// if main menu is found
if (mainMenu != undefined) {
// get items of main menu
var mainMenuItems = mainMenu.get_Items();
// add "Annotation" menu panel
mainMenuItems.addItem("annotationsMenuPanel");
}