window.onload = function() {
//DsPdfViewer.LicenseKey = "***key***";
const options = {
workerSrc: "/diodocs/pdfviewer/demos/product-bundles/build/dspdfviewer.worker.js",
supportApi: getSupportApiSettings(),
restoreViewStateOnLoad: false
};
const viewer = new DsPdfViewer("#viewer", options);
viewer.addDefaultPanels();
viewer.addAnnotationEditorPanel();
viewer.addFormEditorPanel();
viewer.onAfterOpen.register(function() {
viewer.layoutMode = 1;
});
viewer.toolbarLayout.annotationEditor = {
default: ['edit-select', '$split', 'edit-square', 'edit-circle', 'edit-line', 'edit-polyline', 'edit-polygon', 'edit-ink', '$split', 'redact', 'redact-apply', 'save', '$split', 'edit-undo', 'edit-redo'],
mobile: ['edit-select', '$split', 'edit-square', 'edit-circle', 'edit-line', 'edit-polyline', 'edit-polygon', 'edit-ink', '$split', 'redact', 'redact-apply', 'save', '$split', 'edit-undo', 'edit-redo'],
fullscreen: ['$fullscreen', '$split', 'edit-select', '$split', 'edit-square', 'edit-circle', 'edit-line', 'edit-polyline', 'edit-polygon', 'edit-ink', '$split', 'redact', 'redact-apply', 'save', '$split', 'edit-undo', 'edit-redo']
};
viewer.toolbarLayout.formEditor = {
default: ["edit-select-field", "$split", "edit-widget-tx-field", "edit-widget-tx-text-area", "edit-widget-btn-push", "edit-widget-btn-checkbox", "edit-widget-btn-radio", "save", "$split", "edit-undo", "edit-redo"],
mobile: ["edit-select-field", "$split", "edit-widget-tx-field", "edit-widget-tx-text-area", "edit-widget-btn-push", "edit-widget-btn-checkbox", "edit-widget-btn-radio", "save", "$split", "edit-undo", "edit-redo"],
fullscreen: ["$fullscreen", "edit-select-field", "$split", "edit-widget-tx-field", "edit-widget-tx-text-area", "edit-widget-btn-push", "edit-widget-btn-checkbox", "edit-widget-btn-radio", "save", "$split", "edit-undo", "edit-redo"]
};
// 注釈やフォームを追加する機能を連続で実行できるよう設定
viewer.toolbarLayout.stickyBehavior = ['edit-ink', 'edit-square', 'edit-circle', 'edit-line', 'edit-polyline', 'edit-polygon', "edit-redact",
"edit-widget-tx-field", "edit-widget-tx-text-area", "edit-widget-btn-push", "edit-widget-btn-checkbox", "edit-widget-btn-radio"];
viewer.applyToolbarLayout();
viewer.open("/diodocs/pdfviewer/demos/product-bundles/assets/pdf/JapaneseNovel-annotated.pdf");
}
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ツールバーボタン機能の連続実行</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./src/styles.css">
<script src="/diodocs/pdfviewer/demos/product-bundles/build/dspdfviewer.js"></script>
<script src="/diodocs/pdfviewer/demos/product-bundles/build/wasmSupportApi.js"></script>
<script src="/diodocs/pdfviewer/demos/resource/js/init.js"></script>
<script src="./src/app.js"></script>
</head>
<body>
<div id="viewer"></div>
</body>
</html>
#viewer { height: 100%; }