独自の定義済みスタンプをクライアントサイドで指定する

window.onload = function(){ //DsPdfViewer.LicenseKey = "***key***"; const viewer = new DsPdfViewer("#viewer", { workerSrc: "/diodocs/pdfviewer/demos/product-bundles/build/dspdfviewer.worker.js", supportApi: getSupportApiSettings(), stamp: { stampCategories: [ { name: '絵', dpi: 96, stampImageUrls: ['/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/brig_mercury.jpg', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/night_in_venice.jpg', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/ninth_wave.jpg', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/sea.jpg', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/sunset.jpg', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/tower.jpg'] }, { name: 'その他', stampImageUrls: ['/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/stamp1.png', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/stamp2.png', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/stamp3.png', '/diodocs/pdfviewer/demos/product-bundles/assets/images/stamps/stamp4.png'] } ] }, restoreViewStateOnLoad: false, language: "ja" }); viewer.addDefaultPanels(); viewer.addAnnotationEditorPanel(); viewer.onAfterOpen.register(function() { viewer.layoutMode = 1; viewer.zoomMode = 1; }); viewer.toolbarLayout.viewer = { default: ['save', '$navigation', '$split', 'text-selection', 'pan', '$zoom', '$fullscreen', 'download', 'print', 'rotate', 'view-mode', 'hide-annotations', 'doc-properties', 'about'], mobile: ['save', '$navigation', '$split', 'text-selection', 'pan', '$zoom', '$fullscreen', 'download', 'print', 'rotate', 'view-mode', 'hide-annotations', 'doc-properties', 'about'], fullscreen: ['$fullscreen', 'save', '$navigation', '$split', 'text-selection', 'pan', '$zoom', '$fullscreen', 'download', 'print', 'rotate', 'view-mode', 'hide-annotations', 'doc-properties', 'about'] }; viewer.toolbarLayout.annotationEditor = { default: ['open', 'edit-select', '$split', 'edit-stamp', '$split', 'edit-undo', 'edit-redo', 'save'], mobile: ['open', 'edit-select', '$split', 'edit-stamp', '$split', 'edit-undo', 'edit-redo', 'save'], fullscreen: ['$fullscreen', 'edit-select', '$split', 'edit-stamp', '$split', 'edit-undo', 'edit-redo', 'save'] }; viewer.applyToolbarLayout(); viewer.open("/diodocs/pdfviewer/demos/product-bundles/assets/pdf/helloworld.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%; }