@pdftools/four-heights-pdf-web-viewer 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +446 -0
- package/README.md +145 -0
- package/css/pdf-web-viewer.css +2407 -0
- package/doc/PdfWebViewer.pdf +0 -0
- package/es6/common/Checkbox.d.ts +9 -0
- package/es6/common/Checkbox.js +8 -0
- package/es6/common/Color.d.ts +23 -0
- package/es6/common/Color.js +118 -0
- package/es6/common/ColorPicker.d.ts +15 -0
- package/es6/common/ColorPicker.js +46 -0
- package/es6/common/Contextbar.d.ts +6 -0
- package/es6/common/Contextbar.js +19 -0
- package/es6/common/DragMoveHandler.d.ts +51 -0
- package/es6/common/DragMoveHandler.js +175 -0
- package/es6/common/Dropdown.d.ts +36 -0
- package/es6/common/Dropdown.js +76 -0
- package/es6/common/DropdownMenu.d.ts +9 -0
- package/es6/common/DropdownMenu.js +10 -0
- package/es6/common/DropdownSeparator.d.ts +3 -0
- package/es6/common/DropdownSeparator.js +6 -0
- package/es6/common/Icon.d.ts +13 -0
- package/es6/common/Icon.js +8 -0
- package/es6/common/Loader.d.ts +3 -0
- package/es6/common/Loader.js +6 -0
- package/es6/common/RangeSlider.d.ts +17 -0
- package/es6/common/RangeSlider.js +42 -0
- package/es6/common/StrokeStylePicker.d.ts +11 -0
- package/es6/common/StrokeStylePicker.js +20 -0
- package/es6/common/StrokeWidthPicker.d.ts +11 -0
- package/es6/common/StrokeWidthPicker.js +20 -0
- package/es6/common/Toolbar.d.ts +10 -0
- package/es6/common/Toolbar.js +6 -0
- package/es6/common/ToolbarButton.d.ts +14 -0
- package/es6/common/ToolbarButton.js +21 -0
- package/es6/common/ToolbarFileButton.d.ts +15 -0
- package/es6/common/ToolbarFileButton.js +27 -0
- package/es6/common/ToolbarItemGroup.d.ts +8 -0
- package/es6/common/ToolbarItemGroup.js +12 -0
- package/es6/common/ToolbarSeparator.d.ts +3 -0
- package/es6/common/ToolbarSeparator.js +6 -0
- package/es6/common/Tools.d.ts +10 -0
- package/es6/common/Tools.js +89 -0
- package/es6/common/TooltipManager.d.ts +12 -0
- package/es6/common/TooltipManager.js +54 -0
- package/es6/common/TranslationManager.d.ts +11 -0
- package/es6/common/TranslationManager.js +61 -0
- package/es6/common/classNames.d.ts +2 -0
- package/es6/common/classNames.js +18 -0
- package/es6/common/formatDate.d.ts +1 -0
- package/es6/common/formatDate.js +1 -0
- package/es6/common/icons.d.ts +13 -0
- package/es6/common/icons.js +412 -0
- package/es6/common/utils.d.ts +2 -0
- package/es6/common/utils.js +19 -0
- package/es6/custom/history.d.ts +2 -0
- package/es6/custom/history.js +59 -0
- package/es6/index.d.ts +5 -0
- package/es6/index.js +5 -0
- package/es6/lib/hyperapp/index.d.ts +108 -0
- package/es6/lib/hyperapp/index.js +327 -0
- package/es6/modules/CanvasLayer.d.ts +32 -0
- package/es6/modules/CanvasLayer.js +83 -0
- package/es6/modules/CanvasModule.d.ts +59 -0
- package/es6/modules/CanvasModule.js +98 -0
- package/es6/modules/eraser/EraserLayer.d.ts +13 -0
- package/es6/modules/eraser/EraserLayer.js +141 -0
- package/es6/modules/eraser/EraserModule.d.ts +19 -0
- package/es6/modules/eraser/EraserModule.js +34 -0
- package/es6/modules/eraser/EraserToolbar.d.ts +10 -0
- package/es6/modules/eraser/EraserToolbar.js +30 -0
- package/es6/modules/form-fields/CheckBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/CheckBoxWidget.js +45 -0
- package/es6/modules/form-fields/ComboBoxWidget.d.ts +22 -0
- package/es6/modules/form-fields/ComboBoxWidget.js +152 -0
- package/es6/modules/form-fields/EditFormFieldLayer.d.ts +17 -0
- package/es6/modules/form-fields/EditFormFieldLayer.js +238 -0
- package/es6/modules/form-fields/FormFieldModule.d.ts +15 -0
- package/es6/modules/form-fields/FormFieldModule.js +27 -0
- package/es6/modules/form-fields/ListBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/ListBoxWidget.js +73 -0
- package/es6/modules/form-fields/RadioButtonWidget.d.ts +9 -0
- package/es6/modules/form-fields/RadioButtonWidget.js +45 -0
- package/es6/modules/form-fields/SelectListWidget.d.ts +9 -0
- package/es6/modules/form-fields/SelectListWidget.js +45 -0
- package/es6/modules/form-fields/TextBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/TextBoxWidget.js +53 -0
- package/es6/modules/form-fields/WidgetBase.d.ts +23 -0
- package/es6/modules/form-fields/WidgetBase.js +29 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.d.ts +19 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js +181 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.d.ts +21 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js +37 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.d.ts +20 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js +211 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.d.ts +50 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js +118 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.d.ts +28 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.js +58 -0
- package/es6/modules/freetext-annotation/RichTextEditor.d.ts +31 -0
- package/es6/modules/freetext-annotation/RichTextEditor.js +223 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.d.ts +31 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js +289 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.d.ts +20 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js +52 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js +104 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js +28 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.d.ts +27 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.js +54 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.d.ts +23 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.js +169 -0
- package/es6/modules/index.d.ts +13 -0
- package/es6/modules/index.js +13 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.d.ts +40 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.js +503 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.d.ts +30 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.js +53 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.d.ts +20 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.js +137 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.d.ts +25 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.js +47 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.d.ts +27 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.js +50 -0
- package/es6/modules/popup/Popup.d.ts +64 -0
- package/es6/modules/popup/Popup.js +360 -0
- package/es6/modules/popup/PopupLayer.d.ts +31 -0
- package/es6/modules/popup/PopupLayer.js +509 -0
- package/es6/modules/popup/PopupModule.d.ts +16 -0
- package/es6/modules/popup/PopupModule.js +25 -0
- package/es6/modules/print-service/PrintServiceDialog.d.ts +30 -0
- package/es6/modules/print-service/PrintServiceDialog.js +134 -0
- package/es6/modules/print-service/PrintServiceLayer.d.ts +24 -0
- package/es6/modules/print-service/PrintServiceLayer.js +310 -0
- package/es6/modules/print-service/PrintServiceModule.d.ts +18 -0
- package/es6/modules/print-service/PrintServiceModule.js +30 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.d.ts +24 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.js +210 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.d.ts +26 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js +69 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.d.ts +19 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.js +148 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.d.ts +24 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js +57 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.d.ts +28 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.js +50 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.d.ts +19 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.js +257 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.d.ts +17 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js +68 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.d.ts +20 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.js +35 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.d.ts +14 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.js +132 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.d.ts +15 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.js +27 -0
- package/es6/modules/text-annotation/TextAnnotationModule.d.ts +19 -0
- package/es6/modules/text-annotation/TextAnnotationModule.js +34 -0
- package/es6/pdf-viewer-api/ImageContainer.d.ts +10 -0
- package/es6/pdf-viewer-api/ImageContainer.js +43 -0
- package/es6/pdf-viewer-api/PdfViewerApi.d.ts +463 -0
- package/es6/pdf-viewer-api/PdfViewerApi.js +732 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.d.ts +178 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.js +2037 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.d.ts +3 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.js +30 -0
- package/es6/pdf-viewer-api/enums.d.ts +100 -0
- package/es6/pdf-viewer-api/enums.js +113 -0
- package/es6/pdf-viewer-api/index.d.ts +3 -0
- package/es6/pdf-viewer-api/index.js +3 -0
- package/es6/pdf-viewer-api/types.d.ts +284 -0
- package/es6/pdf-viewer-api/types.js +6 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.d.ts +76 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.js +345 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.d.ts +175 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.js +1226 -0
- package/es6/pdf-viewer-canvas/state/annotations.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/annotations.js +157 -0
- package/es6/pdf-viewer-canvas/state/appState.d.ts +10 -0
- package/es6/pdf-viewer-canvas/state/appState.js +60 -0
- package/es6/pdf-viewer-canvas/state/canvas.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/canvas.js +41 -0
- package/es6/pdf-viewer-canvas/state/document.d.ts +50 -0
- package/es6/pdf-viewer-canvas/state/document.js +99 -0
- package/es6/pdf-viewer-canvas/state/pointer.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/pointer.js +31 -0
- package/es6/pdf-viewer-canvas/state/scroll.d.ts +22 -0
- package/es6/pdf-viewer-canvas/state/scroll.js +25 -0
- package/es6/pdf-viewer-canvas/state/search.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/search.js +27 -0
- package/es6/pdf-viewer-canvas/state/store.d.ts +39 -0
- package/es6/pdf-viewer-canvas/state/store.js +52 -0
- package/es6/pdf-viewer-canvas/state/viewer.d.ts +91 -0
- package/es6/pdf-viewer-canvas/state/viewer.js +175 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.d.ts +28 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js +452 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.d.ts +9 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js +25 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.d.ts +10 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.d.ts +48 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js +308 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.d.ts +19 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js +289 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.d.ts +31 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js +106 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.d.ts +11 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.d.ts +3 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.js +10 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.d.ts +52 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js +377 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.d.ts +47 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js +102 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.d.ts +14 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js +36 -0
- package/es6/pdf-viewing/PdfViewing.d.ts +4865 -0
- package/es6/pdf-viewing/PdfViewing.js +9611 -0
- package/es6/pdf-web-viewer/PdfWebViewer.d.ts +372 -0
- package/es6/pdf-web-viewer/PdfWebViewer.js +1386 -0
- package/es6/pdf-web-viewer/UserSettings.d.ts +8 -0
- package/es6/pdf-web-viewer/UserSettings.js +40 -0
- package/es6/pdf-web-viewer/WebViewerOptions.d.ts +387 -0
- package/es6/pdf-web-viewer/WebViewerOptions.js +582 -0
- package/es6/pdf-web-viewer/state/index.d.ts +80 -0
- package/es6/pdf-web-viewer/state/index.js +98 -0
- package/es6/pdf-web-viewer/state/layout.d.ts +24 -0
- package/es6/pdf-web-viewer/state/layout.js +21 -0
- package/es6/pdf-web-viewer/state/mobile.d.ts +16 -0
- package/es6/pdf-web-viewer/state/mobile.js +11 -0
- package/es6/pdf-web-viewer/state/navigationPanel.d.ts +61 -0
- package/es6/pdf-web-viewer/state/navigationPanel.js +84 -0
- package/es6/pdf-web-viewer/state/passwordForm.d.ts +18 -0
- package/es6/pdf-web-viewer/state/passwordForm.js +21 -0
- package/es6/pdf-web-viewer/state/pdfDocument.d.ts +31 -0
- package/es6/pdf-web-viewer/state/pdfDocument.js +41 -0
- package/es6/pdf-web-viewer/state/search.d.ts +29 -0
- package/es6/pdf-web-viewer/state/search.js +23 -0
- package/es6/pdf-web-viewer/views/App.d.ts +4 -0
- package/es6/pdf-web-viewer/views/App.js +19 -0
- package/es6/pdf-web-viewer/views/CustomButtons.d.ts +9 -0
- package/es6/pdf-web-viewer/views/CustomButtons.js +18 -0
- package/es6/pdf-web-viewer/views/DropZone.d.ts +9 -0
- package/es6/pdf-web-viewer/views/DropZone.js +53 -0
- package/es6/pdf-web-viewer/views/Layout.d.ts +4 -0
- package/es6/pdf-web-viewer/views/Layout.js +22 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js +21 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js +35 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js +22 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.js +26 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.js +36 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.js +80 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.js +74 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.js +83 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.d.ts +10 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.js +55 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.js +52 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.js +18 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.js +25 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.js +6 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/Modal.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/Modal.js +39 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.js +30 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.js +13 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.js +54 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.js +32 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.js +26 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js +158 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js +11 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.js +50 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.d.ts +12 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.js +19 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js +10 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.d.ts +16 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js +32 -0
- package/package.json +24 -0
- package/pdfwebviewer/PdfViewing.data +0 -0
- package/pdfwebviewer/PdfViewing_Main.js +1 -0
- package/pdfwebviewer/PdfViewing_Main.wasm +0 -0
- package/pdfwebviewer/PdfViewing_Worker.js +1 -0
- package/pdfwebviewer/PdfViewing_Worker.wasm +0 -0
- package/pdfwebviewer/pdf-web-viewer.css +2407 -0
- package/pdfwebviewer/pdf-web-viewer.development.js +25955 -0
- package/pdfwebviewer/pdf-web-viewer.min.js +1 -0
- package/pdfwebviewer/translations.de.json +151 -0
- package/pdfwebviewer/translations.en.json +151 -0
- package/pdfwebviewer/translations.fr.json +151 -0
- package/pdfwebviewer/translations.it.json +151 -0
- package/scss/common/_breakpoints.scss +44 -0
- package/scss/common/_buttons.scss +42 -0
- package/scss/common/_colorpicker.scss +89 -0
- package/scss/common/_common.scss +21 -0
- package/scss/common/_contextbar.scss +44 -0
- package/scss/common/_dropdown.scss +176 -0
- package/scss/common/_icon.scss +9 -0
- package/scss/common/_index.scss +19 -0
- package/scss/common/_loader.scss +30 -0
- package/scss/common/_rangeslider.scss +24 -0
- package/scss/common/_scrollbars.scss +64 -0
- package/scss/common/_stroke-style-picker.scss +64 -0
- package/scss/common/_stroke-width-picker.scss +23 -0
- package/scss/common/_toolbar.scss +117 -0
- package/scss/common/_tooltip.scss +39 -0
- package/scss/modules/_eraser.scss +28 -0
- package/scss/modules/_forms.scss +56 -0
- package/scss/modules/_highlightannotation.scss +12 -0
- package/scss/modules/_index.scss +5 -0
- package/scss/modules/_inkannotation.scss +41 -0
- package/scss/modules/_stampannotation.scss +19 -0
- package/scss/pdf-viewer-canvas/_annotationborder.scss +107 -0
- package/scss/pdf-viewer-canvas/_busy-loader.scss +53 -0
- package/scss/pdf-viewer-canvas/_freetexteditor.scss +28 -0
- package/scss/pdf-viewer-canvas/_index.scss +7 -0
- package/scss/pdf-viewer-canvas/_layout.scss +52 -0
- package/scss/pdf-viewer-canvas/_popup.scss +217 -0
- package/scss/pdf-viewer-canvas/_printservice.scss +171 -0
- package/scss/pdf-viewer-canvas/_textselection.scss +17 -0
- package/scss/pdf-web-viewer/_annotationbar.scss +47 -0
- package/scss/pdf-web-viewer/_index.scss +8 -0
- package/scss/pdf-web-viewer/_layout.scss +63 -0
- package/scss/pdf-web-viewer/_modal.scss +186 -0
- package/scss/pdf-web-viewer/_navigationpanel.scss +398 -0
- package/scss/pdf-web-viewer/_searchbar.scss +47 -0
- package/scss/pdf-web-viewer/_toolbar.scss +134 -0
- package/scss/pdf-web-viewer/_viewer.scss +54 -0
- package/scss/pdf-web-viewer.scss +1 -0
- package/scss/themes/default/_light.scss +32 -0
- package/scss/themes/default/_mixins.scss +129 -0
- package/scss/themes/default/_theme.scss +161 -0
- package/scss/themes/pdf-web-viewer.scss +1 -0
- package/umd/pdf-web-viewer.development.js +25955 -0
- package/umd/pdf-web-viewer.development.js.map +1 -0
- package/umd/pdf-web-viewer.min.js +1 -0
- package/wasm/PdfViewing.data +0 -0
- package/wasm/PdfViewing_Main.js +1 -0
- package/wasm/PdfViewing_Main.wasm +0 -0
- package/wasm/PdfViewing_Worker.js +1 -0
- package/wasm/PdfViewing_Worker.wasm +0 -0
- package/wasm/translations.de.json +151 -0
- package/wasm/translations.en.json +151 -0
- package/wasm/translations.fr.json +151 -0
- package/wasm/translations.it.json +151 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { PdfItemType, StampAnnotationColor, } from '../../pdf-viewer-api';
|
|
3
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
4
|
+
import { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';
|
|
5
|
+
import { createAddStampAnnotationToolbar } from './AddStampAnnotationToolbar';
|
|
6
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
7
|
+
import { imageDataUrlToUint8Array } from '../../common/Tools';
|
|
8
|
+
const moduleLayerName = 'AddStampAnnotation';
|
|
9
|
+
export class AddStampAnnotationLayer extends CanvasLayer {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.context = null;
|
|
13
|
+
this.pointerDown = false;
|
|
14
|
+
this.startPoint = null;
|
|
15
|
+
this.stampRect = null;
|
|
16
|
+
this.page = 0;
|
|
17
|
+
this.screenPageRect = null;
|
|
18
|
+
this.aspectRatio = null;
|
|
19
|
+
this.stamps = [];
|
|
20
|
+
}
|
|
21
|
+
onCreate() {
|
|
22
|
+
this.setStamp = this.setStamp.bind(this);
|
|
23
|
+
this.close = this.close.bind(this);
|
|
24
|
+
this.context = this.createCanvas();
|
|
25
|
+
this.stamps = this.options.annotation.stamps;
|
|
26
|
+
/* tslint:disable-next-line:align */
|
|
27
|
+
const toolbarElement = this.module.toolbarElement;
|
|
28
|
+
this.setStamp(this.options.annotation.selectedStamp);
|
|
29
|
+
createAddStampAnnotationToolbar({
|
|
30
|
+
selectedStamp: this.options.annotation.selectedStamp,
|
|
31
|
+
stamps: this.stamps,
|
|
32
|
+
onStampChanged: this.setStamp,
|
|
33
|
+
onClose: this.close,
|
|
34
|
+
}, toolbarElement);
|
|
35
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
36
|
+
}
|
|
37
|
+
onSave() {
|
|
38
|
+
const promise = new Promise((resolve, reject) => {
|
|
39
|
+
resolve();
|
|
40
|
+
});
|
|
41
|
+
return promise;
|
|
42
|
+
}
|
|
43
|
+
onRemove() {
|
|
44
|
+
this.removeCanvasElements();
|
|
45
|
+
this.context = null;
|
|
46
|
+
/* tslint:disable-next-line:align */
|
|
47
|
+
const toolbarElement = this.module.toolbarElement;
|
|
48
|
+
toolbarElement.innerHTML = '';
|
|
49
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
50
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
51
|
+
}
|
|
52
|
+
render(timestamp, state) {
|
|
53
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
54
|
+
this.remove();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!this.aspectRatio) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (this.context) {
|
|
61
|
+
const update = state.viewer.modeChanged ||
|
|
62
|
+
state.pointer.positionChanged ||
|
|
63
|
+
state.pointer.action ||
|
|
64
|
+
state.document.zoomChanged;
|
|
65
|
+
if (update) {
|
|
66
|
+
const ctx = this.context;
|
|
67
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
68
|
+
const pointerPos = { x: state.pointer.x.devicePixels, y: state.pointer.y.devicePixels };
|
|
69
|
+
const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
|
|
70
|
+
if (pointerPdfPos.isOnPage) {
|
|
71
|
+
this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);
|
|
75
|
+
}
|
|
76
|
+
if (state.pointer.isDown) {
|
|
77
|
+
if (!this.pointerDown) {
|
|
78
|
+
if (!pointerPdfPos.isOnPage) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.startPoint = pointerPos;
|
|
82
|
+
this.page = pointerPdfPos.pdfPoint.page;
|
|
83
|
+
this.pointerDown = true;
|
|
84
|
+
this.screenPageRect = this.pdfApi.getPageScreenRect(this.page);
|
|
85
|
+
}
|
|
86
|
+
if (this.startPoint && this.screenPageRect) {
|
|
87
|
+
this.stampRect = getRectFromSelection(state.document, {
|
|
88
|
+
x: this.startPoint.x,
|
|
89
|
+
y: this.startPoint.y,
|
|
90
|
+
}, {
|
|
91
|
+
x: pointerPos.x,
|
|
92
|
+
y: pointerPos.y,
|
|
93
|
+
});
|
|
94
|
+
if (this.stampRect) {
|
|
95
|
+
this.stampRect.h = this.stampRect.w / this.aspectRatio;
|
|
96
|
+
const lineWidth = 2 * devicePixelRatio;
|
|
97
|
+
ctx.save();
|
|
98
|
+
ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
|
|
99
|
+
ctx.fillStyle = this.options.viewer.general.textSelectionColor;
|
|
100
|
+
ctx.lineWidth = lineWidth;
|
|
101
|
+
ctx.setLineDash([lineWidth, lineWidth]);
|
|
102
|
+
if (this.startPoint.y > pointerPos.y) {
|
|
103
|
+
this.stampRect.y = this.startPoint.y - this.stampRect.h;
|
|
104
|
+
if (this.stampRect.y < this.screenPageRect.y) {
|
|
105
|
+
this.stampRect.y = this.screenPageRect.y;
|
|
106
|
+
this.stampRect.w = this.stampRect.h * this.aspectRatio;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if (this.startPoint.y + this.stampRect.h >
|
|
111
|
+
this.screenPageRect.y + this.screenPageRect.h) {
|
|
112
|
+
this.stampRect.h =
|
|
113
|
+
this.screenPageRect.y + this.screenPageRect.h - this.startPoint.y;
|
|
114
|
+
this.stampRect.w = this.stampRect.h * this.aspectRatio;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
ctx.strokeRect(this.stampRect.x, this.stampRect.y, this.stampRect.w, this.stampRect.h);
|
|
118
|
+
ctx.globalAlpha = 0.33;
|
|
119
|
+
ctx.fillRect(this.stampRect.x, this.stampRect.y, this.stampRect.w, this.stampRect.h);
|
|
120
|
+
ctx.restore();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (this.pointerDown && this.startPoint) {
|
|
125
|
+
if (this.stampRect) {
|
|
126
|
+
this.createStampAnnotation(this.stampRect);
|
|
127
|
+
this.pointerDown = false;
|
|
128
|
+
this.startPoint = null;
|
|
129
|
+
this.stampRect = null;
|
|
130
|
+
this.page = 0;
|
|
131
|
+
this.aspectRatio = null;
|
|
132
|
+
this.screenPageRect = null;
|
|
133
|
+
this.remove();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
close() {
|
|
141
|
+
this.remove();
|
|
142
|
+
}
|
|
143
|
+
setStamp(stampIndex) {
|
|
144
|
+
if (this.stamps.length == 0) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (stampIndex >= this.stamps.length) {
|
|
148
|
+
stampIndex = 0;
|
|
149
|
+
}
|
|
150
|
+
this.options.annotation.selectedStamp = stampIndex;
|
|
151
|
+
const stamp = this.stamps[stampIndex];
|
|
152
|
+
// todo: handle pdf stamps
|
|
153
|
+
if (stamp.aspectRatio) {
|
|
154
|
+
this.aspectRatio = stamp.aspectRatio;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (stamp.image) {
|
|
158
|
+
const img = new Image();
|
|
159
|
+
img.onload = () => {
|
|
160
|
+
this.aspectRatio = img.width / img.height;
|
|
161
|
+
};
|
|
162
|
+
img.src = stamp.image;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.pdfApi
|
|
166
|
+
.getTextStampAspectRatio(stamp.text ? stamp.text : translationManager.getText(stamp.translation_key))
|
|
167
|
+
.then((aspectRatio) => {
|
|
168
|
+
this.aspectRatio = aspectRatio;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
createStampAnnotation(rect) {
|
|
172
|
+
const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);
|
|
173
|
+
if (this.aspectRatio && (pdfRect.pdfW < 2 || pdfRect.pdfH < 2)) {
|
|
174
|
+
switch (this.pdfApi.getRotation()) {
|
|
175
|
+
case 0:
|
|
176
|
+
pdfRect.pdfW = this.options.annotation.defaultStampWidth;
|
|
177
|
+
pdfRect.pdfH = pdfRect.pdfW / this.aspectRatio;
|
|
178
|
+
pdfRect.pdfY -= pdfRect.pdfH;
|
|
179
|
+
break;
|
|
180
|
+
case 90:
|
|
181
|
+
pdfRect.pdfH = this.options.annotation.defaultStampWidth;
|
|
182
|
+
pdfRect.pdfW = pdfRect.pdfH / this.aspectRatio;
|
|
183
|
+
break;
|
|
184
|
+
case 180:
|
|
185
|
+
pdfRect.pdfW = this.options.annotation.defaultStampWidth;
|
|
186
|
+
pdfRect.pdfH = pdfRect.pdfW / this.aspectRatio;
|
|
187
|
+
pdfRect.pdfX -= pdfRect.pdfW;
|
|
188
|
+
break;
|
|
189
|
+
case 270:
|
|
190
|
+
pdfRect.pdfH = this.options.annotation.defaultStampWidth;
|
|
191
|
+
pdfRect.pdfW = pdfRect.pdfH / this.aspectRatio;
|
|
192
|
+
pdfRect.pdfX -= pdfRect.pdfW;
|
|
193
|
+
pdfRect.pdfY -= pdfRect.pdfH;
|
|
194
|
+
break;
|
|
195
|
+
default:
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const stampSetting = this.stamps[this.options.annotation.selectedStamp];
|
|
200
|
+
if (stampSetting.pdfStampFileName) {
|
|
201
|
+
this.pdfApi
|
|
202
|
+
.registerPdfPage(stampSetting.pdfStampFileName, stampSetting.pageNumber)
|
|
203
|
+
.then((imageId) => {
|
|
204
|
+
const annotation = {
|
|
205
|
+
itemType: PdfItemType.STAMP,
|
|
206
|
+
imageId,
|
|
207
|
+
page: pdfRect.page,
|
|
208
|
+
color: this.options.annotation.colors.defaultHighlightColor,
|
|
209
|
+
pdfRect,
|
|
210
|
+
author: this.options.viewer.general.user,
|
|
211
|
+
};
|
|
212
|
+
this.pdfApi.createItem(annotation).then((annot) => {
|
|
213
|
+
this.onAnnotationCreated(annot);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
else if (stampSetting.image) {
|
|
218
|
+
const imgData = imageDataUrlToUint8Array(stampSetting.image);
|
|
219
|
+
this.pdfApi.registerStampImage(imgData).then((imageId) => {
|
|
220
|
+
const annotation = {
|
|
221
|
+
itemType: PdfItemType.STAMP,
|
|
222
|
+
imageId,
|
|
223
|
+
page: pdfRect.page,
|
|
224
|
+
color: this.options.annotation.colors.defaultHighlightColor,
|
|
225
|
+
pdfRect,
|
|
226
|
+
author: this.options.viewer.general.user,
|
|
227
|
+
};
|
|
228
|
+
this.pdfApi.createItem(annotation).then((annot) => {
|
|
229
|
+
this.onAnnotationCreated(annot);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
let stampColor = null;
|
|
235
|
+
let stampName = null;
|
|
236
|
+
if (stampSetting) {
|
|
237
|
+
stampColor = stampSetting.color;
|
|
238
|
+
stampName = stampSetting.pdfStampName !== undefined ? stampSetting.pdfStampName : null;
|
|
239
|
+
}
|
|
240
|
+
const annotation = {
|
|
241
|
+
itemType: PdfItemType.STAMP,
|
|
242
|
+
color: this.options.annotation.colors.defaultHighlightColor,
|
|
243
|
+
author: this.options.viewer.general.user,
|
|
244
|
+
page: pdfRect.page,
|
|
245
|
+
pdfRect,
|
|
246
|
+
stampName,
|
|
247
|
+
stampText: stampSetting.text
|
|
248
|
+
? stampSetting.text
|
|
249
|
+
: translationManager.getText(stampSetting.translation_key),
|
|
250
|
+
stampColor: stampColor != null ? stampColor : StampAnnotationColor.GREEN,
|
|
251
|
+
};
|
|
252
|
+
this.pdfApi.createItem(annotation).then((annot) => {
|
|
253
|
+
this.onAnnotationCreated(annot);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DropdownItem } from '../../common/Dropdown';
|
|
2
|
+
export interface AddStampAnnotationToolbarProps {
|
|
3
|
+
selectedStamp: number;
|
|
4
|
+
stamps: any[];
|
|
5
|
+
onStampChanged(stamp: number): void;
|
|
6
|
+
onClose(): void;
|
|
7
|
+
}
|
|
8
|
+
interface AddStampAnnotationToolbarState {
|
|
9
|
+
selectedStamp: number;
|
|
10
|
+
stamps: any[];
|
|
11
|
+
stampDropdownItems: DropdownItem[];
|
|
12
|
+
}
|
|
13
|
+
export interface AddStampAnnotationToolbarActions {
|
|
14
|
+
setStamp(stamp: number): AddStampAnnotationToolbarState;
|
|
15
|
+
}
|
|
16
|
+
export declare const createAddStampAnnotationToolbar: (props: AddStampAnnotationToolbarProps, element: HTMLElement) => AddStampAnnotationToolbarActions;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { app, h } from '../../lib/hyperapp';
|
|
2
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
3
|
+
import { Toolbar } from '../../common/Toolbar';
|
|
4
|
+
import { ToolbarItemGroup } from '../../common/ToolbarItemGroup';
|
|
5
|
+
import { ToolbarButton } from '../../common/ToolbarButton';
|
|
6
|
+
import { icons } from '../../common/icons';
|
|
7
|
+
import { ToolbarSeparator } from '../../common/ToolbarSeparator';
|
|
8
|
+
import { Dropdown } from '../../common/Dropdown';
|
|
9
|
+
export const createAddStampAnnotationToolbar = (props, element) => {
|
|
10
|
+
const state = {
|
|
11
|
+
stamps: props.stamps,
|
|
12
|
+
stampDropdownItems: [],
|
|
13
|
+
selectedStamp: props.selectedStamp,
|
|
14
|
+
};
|
|
15
|
+
const actions = {
|
|
16
|
+
setStamp: (stamp) => ($state) => {
|
|
17
|
+
props.onStampChanged(stamp);
|
|
18
|
+
return Object.assign(Object.assign({}, $state), { selectedStamp: stamp });
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const DropdownStampItem = (item) => {
|
|
22
|
+
const stamp = state.stamps[item.value];
|
|
23
|
+
if (stamp.thumbnail) {
|
|
24
|
+
return (h("div", { title: stamp.title || '' },
|
|
25
|
+
h("img", { src: stamp.thumbnail })));
|
|
26
|
+
}
|
|
27
|
+
// todo: handle pdf stamps
|
|
28
|
+
if (stamp.name) {
|
|
29
|
+
return h("div", { title: stamp.title || '' }, stamp.name);
|
|
30
|
+
}
|
|
31
|
+
return (h("div", { title: stamp.title || '' }, stamp.image
|
|
32
|
+
? stamp.name
|
|
33
|
+
: stamp.text
|
|
34
|
+
? stamp.text
|
|
35
|
+
: translationManager.getText(stamp.translation_key)));
|
|
36
|
+
};
|
|
37
|
+
const DropdownButton = (value) => {
|
|
38
|
+
if (value === -1) {
|
|
39
|
+
return (h("div", { class: "pwv-Dropdown-text" }, translationManager.getText('annotStamp.chooseStamp')));
|
|
40
|
+
}
|
|
41
|
+
const stamp = state.stamps[value];
|
|
42
|
+
if (stamp.thumbnail) {
|
|
43
|
+
return (h("div", { class: "pwv-Dropdown-text" },
|
|
44
|
+
h("img", { src: stamp.thumbnail })));
|
|
45
|
+
}
|
|
46
|
+
// todo: handle pdf stamps
|
|
47
|
+
if (stamp.pdfStampFileName) {
|
|
48
|
+
return h("div", { class: "pwv-Dropdown-text" }, stamp.name);
|
|
49
|
+
}
|
|
50
|
+
return (h("div", { class: "pwv-Dropdown-text" }, stamp.image
|
|
51
|
+
? stamp.name
|
|
52
|
+
: stamp.text
|
|
53
|
+
? stamp.text
|
|
54
|
+
: translationManager.getText(stamp.translation_key)));
|
|
55
|
+
};
|
|
56
|
+
const App = () => h(AddStampAnnotationToolbar, null);
|
|
57
|
+
/* tslint:disable-next-line:max-line-length */
|
|
58
|
+
const AddStampAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
59
|
+
h(ToolbarItemGroup, null,
|
|
60
|
+
h(Dropdown, { className: "pwv-stampannotation-dropdown", value: $state.selectedStamp, items: $state.stamps.map((stamp, index) => ({
|
|
61
|
+
value: index,
|
|
62
|
+
renderItem: DropdownStampItem,
|
|
63
|
+
})), onChange: $actions.setStamp, renderButton: DropdownButton })),
|
|
64
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
65
|
+
h(ToolbarSeparator, null),
|
|
66
|
+
h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));
|
|
67
|
+
return app(state, actions, App, element);
|
|
68
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
export declare class StampAnnotationModule extends CanvasModule {
|
|
3
|
+
annotationbarElement: HTMLElement | null;
|
|
4
|
+
toolbarElement: HTMLElement | null;
|
|
5
|
+
static moduleInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
moduleType: CanvasModuleType;
|
|
8
|
+
requiredFeatures: {
|
|
9
|
+
annotate: boolean;
|
|
10
|
+
fillFormFields: boolean;
|
|
11
|
+
};
|
|
12
|
+
translationKey: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
};
|
|
15
|
+
constructor();
|
|
16
|
+
onRegister(): {
|
|
17
|
+
toolbar: HTMLElement;
|
|
18
|
+
};
|
|
19
|
+
activate(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { AddStampAnnotationLayer } from './AddStampAnnotationLayer';
|
|
3
|
+
export class StampAnnotationModule extends CanvasModule {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.annotationbarElement = null;
|
|
7
|
+
this.toolbarElement = null;
|
|
8
|
+
this.name = StampAnnotationModule.moduleInfo.name;
|
|
9
|
+
this.activate = this.activate.bind(this);
|
|
10
|
+
}
|
|
11
|
+
onRegister() {
|
|
12
|
+
this.toolbarElement = document.createElement('div');
|
|
13
|
+
return {
|
|
14
|
+
toolbar: this.toolbarElement,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
activate() {
|
|
18
|
+
if (!this.canvasLayers['add']) {
|
|
19
|
+
this.createCanvasLayer('add', AddStampAnnotationLayer);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.removeCanvasLayer('add');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
StampAnnotationModule.moduleInfo = {
|
|
27
|
+
name: 'StampAnnotationModule',
|
|
28
|
+
moduleType: CanvasModuleType.Tool,
|
|
29
|
+
requiredFeatures: {
|
|
30
|
+
annotate: true,
|
|
31
|
+
fillFormFields: false,
|
|
32
|
+
},
|
|
33
|
+
translationKey: 'annotStamp.add',
|
|
34
|
+
icon: 'stamp',
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
export declare class AddTextAnnotationLayer extends CanvasLayer {
|
|
4
|
+
private context;
|
|
5
|
+
private colors;
|
|
6
|
+
private selectedColor;
|
|
7
|
+
onCreate(): void;
|
|
8
|
+
onSave(): Promise<void>;
|
|
9
|
+
onRemove(): void;
|
|
10
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
11
|
+
private setColor;
|
|
12
|
+
private close;
|
|
13
|
+
private createTextAnnotation;
|
|
14
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { PdfItemType, } from '../../pdf-viewer-api';
|
|
3
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
4
|
+
import { renderStickyNote } from '../../pdf-viewer-canvas/view-layers/canvasShapes';
|
|
5
|
+
import { createAddTextAnnotationToolbar } from './AddTextAnnotationToolbar';
|
|
6
|
+
const moduleLayerName = 'AddTextAnnotation';
|
|
7
|
+
export class AddTextAnnotationLayer extends CanvasLayer {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.colors = [];
|
|
11
|
+
this.selectedColor = '';
|
|
12
|
+
}
|
|
13
|
+
onCreate() {
|
|
14
|
+
this.setColor = this.setColor.bind(this);
|
|
15
|
+
this.close = this.close.bind(this);
|
|
16
|
+
this.context = this.createCanvas();
|
|
17
|
+
this.colors = this.options.annotation.colors.highlightColors;
|
|
18
|
+
this.selectedColor = this.options.annotation.colors.stickyNoteColor;
|
|
19
|
+
/* tslint:disable-next-line:align */
|
|
20
|
+
const toolbarElement = this.module.toolbarElement;
|
|
21
|
+
createAddTextAnnotationToolbar({
|
|
22
|
+
colors: this.colors,
|
|
23
|
+
selectedColor: this.selectedColor,
|
|
24
|
+
onColorChanged: this.setColor,
|
|
25
|
+
onClose: this.close,
|
|
26
|
+
}, toolbarElement);
|
|
27
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
28
|
+
}
|
|
29
|
+
onSave() {
|
|
30
|
+
const promise = new Promise((resolve, reject) => {
|
|
31
|
+
resolve();
|
|
32
|
+
});
|
|
33
|
+
return promise;
|
|
34
|
+
}
|
|
35
|
+
onRemove() {
|
|
36
|
+
this.removeCanvasElements();
|
|
37
|
+
this.context = null;
|
|
38
|
+
/* tslint:disable-next-line:align */
|
|
39
|
+
const toolbarElement = this.module.toolbarElement;
|
|
40
|
+
toolbarElement.innerHTML = '';
|
|
41
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
42
|
+
}
|
|
43
|
+
render(timestamp, state) {
|
|
44
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
45
|
+
this.remove();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.context &&
|
|
49
|
+
(state.viewer.modeChanged ||
|
|
50
|
+
state.pointer.positionChanged ||
|
|
51
|
+
state.pointer.action ||
|
|
52
|
+
state.canvas.canvasInvalidated)) {
|
|
53
|
+
const ctx = this.context;
|
|
54
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
55
|
+
const scale = state.canvas.pixelRatio * state.document.zoom;
|
|
56
|
+
const s = 6 * scale;
|
|
57
|
+
const h = 22 * scale;
|
|
58
|
+
const rect = {
|
|
59
|
+
w: 26 * scale,
|
|
60
|
+
h,
|
|
61
|
+
x: state.pointer.x.devicePixels - s,
|
|
62
|
+
y: state.pointer.y.devicePixels - h,
|
|
63
|
+
};
|
|
64
|
+
let rectOnPage = false;
|
|
65
|
+
for (const k in state.document.pageRects) {
|
|
66
|
+
if (state.document.pageRects[k]) {
|
|
67
|
+
const p = state.document.pageRects[k];
|
|
68
|
+
const px2 = p.x + p.w;
|
|
69
|
+
const rx2 = rect.x + rect.w;
|
|
70
|
+
const py2 = p.y + p.h;
|
|
71
|
+
const ry2 = rect.y + rect.h;
|
|
72
|
+
if (rect.x >= p.x && rx2 <= px2 && rect.y >= p.y && ry2 <= py2) {
|
|
73
|
+
rectOnPage = true;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (rectOnPage) {
|
|
79
|
+
if (state.pointer.type === 'mouse') {
|
|
80
|
+
renderStickyNote(ctx, scale, rect, this.selectedColor, '#000000');
|
|
81
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
82
|
+
}
|
|
83
|
+
if (state.pointer.action === 'click') {
|
|
84
|
+
rect.y = rect.y;
|
|
85
|
+
this.createTextAnnotation(rect, this.selectedColor);
|
|
86
|
+
this.remove();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
setColor(color) {
|
|
96
|
+
this.selectedColor = color;
|
|
97
|
+
this.options.annotation.colors.stickyNoteColor = color;
|
|
98
|
+
}
|
|
99
|
+
close() {
|
|
100
|
+
this.remove();
|
|
101
|
+
}
|
|
102
|
+
createTextAnnotation(point, color) {
|
|
103
|
+
const pdfPoint = this.pdfApi.transformScreenPointToPdfPoint({
|
|
104
|
+
x: point.x,
|
|
105
|
+
y: point.y,
|
|
106
|
+
}).pdfPoint;
|
|
107
|
+
const annotation = {
|
|
108
|
+
itemType: PdfItemType.TEXT,
|
|
109
|
+
color,
|
|
110
|
+
author: this.options.viewer.general.user,
|
|
111
|
+
page: pdfPoint.page,
|
|
112
|
+
isOpen: true,
|
|
113
|
+
pdfRect: {
|
|
114
|
+
pdfX: pdfPoint.pdfX,
|
|
115
|
+
pdfY: pdfPoint.pdfY,
|
|
116
|
+
pdfW: 0,
|
|
117
|
+
pdfH: 0,
|
|
118
|
+
page: pdfPoint.page,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
this.pdfApi.createItem(annotation).then((item) => {
|
|
122
|
+
const annot = item;
|
|
123
|
+
const annotation = this.pdfApi.getItem(annot.id);
|
|
124
|
+
if (annotation) {
|
|
125
|
+
annotation.popup.isOpen = true;
|
|
126
|
+
this.store.annotations.updateAnnotation(annotation);
|
|
127
|
+
this.store.viewer.selectPopup({ id: annot.id, focus: true });
|
|
128
|
+
}
|
|
129
|
+
this.onAnnotationCreated(annot);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface AddTextAnnotationToolbarProps {
|
|
2
|
+
colors: string[];
|
|
3
|
+
selectedColor: string;
|
|
4
|
+
onColorChanged(color: string): void;
|
|
5
|
+
onClose(): void;
|
|
6
|
+
}
|
|
7
|
+
interface AddTextAnnotationToolbarState {
|
|
8
|
+
colors: string[];
|
|
9
|
+
selectedColor: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AddTextAnnotationToolbarActions {
|
|
12
|
+
setColor(color: string): AddTextAnnotationToolbarState;
|
|
13
|
+
}
|
|
14
|
+
export declare const createAddTextAnnotationToolbar: (props: AddTextAnnotationToolbarProps, element: HTMLElement) => AddTextAnnotationToolbarActions;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { app, h } from '../../lib/hyperapp';
|
|
2
|
+
import { Toolbar } from '../../common/Toolbar';
|
|
3
|
+
import { ToolbarItemGroup } from '../../common/ToolbarItemGroup';
|
|
4
|
+
import { ToolbarButton } from '../../common/ToolbarButton';
|
|
5
|
+
import { icons } from '../../common/icons';
|
|
6
|
+
import { ToolbarSeparator } from '../../common/ToolbarSeparator';
|
|
7
|
+
import { ColorPicker } from '../../common/ColorPicker';
|
|
8
|
+
export const createAddTextAnnotationToolbar = (props, element) => {
|
|
9
|
+
const state = {
|
|
10
|
+
colors: props.colors,
|
|
11
|
+
selectedColor: props.selectedColor,
|
|
12
|
+
};
|
|
13
|
+
const actions = {
|
|
14
|
+
setColor: (color) => ($state) => {
|
|
15
|
+
props.onColorChanged(color);
|
|
16
|
+
return Object.assign(Object.assign({}, $state), { selectedColor: color });
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const App = () => h(AddTextAnnotationToolbar, null);
|
|
20
|
+
const AddTextAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
21
|
+
h(ToolbarItemGroup, null,
|
|
22
|
+
h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: "buttons", onChange: $actions.setColor })),
|
|
23
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
24
|
+
h(ToolbarSeparator, null),
|
|
25
|
+
h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));
|
|
26
|
+
return app(state, actions, App, element);
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
export declare class TextAnnotationModule extends CanvasModule {
|
|
3
|
+
toolbarElement: HTMLElement | null;
|
|
4
|
+
static moduleInfo: {
|
|
5
|
+
name: string;
|
|
6
|
+
moduleType: CanvasModuleType;
|
|
7
|
+
requiredFeatures: {
|
|
8
|
+
annotate: boolean;
|
|
9
|
+
fillFormFields: boolean;
|
|
10
|
+
};
|
|
11
|
+
translationKey: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
};
|
|
14
|
+
constructor();
|
|
15
|
+
onRegister(): {
|
|
16
|
+
toolbar: HTMLElement;
|
|
17
|
+
};
|
|
18
|
+
activate(): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { AddTextAnnotationLayer } from './AddTextAnnotationLayer';
|
|
3
|
+
export class TextAnnotationModule extends CanvasModule {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.toolbarElement = null;
|
|
7
|
+
this.name = TextAnnotationModule.moduleInfo.name;
|
|
8
|
+
this.activate = this.activate.bind(this);
|
|
9
|
+
}
|
|
10
|
+
onRegister() {
|
|
11
|
+
this.toolbarElement = document.createElement('div');
|
|
12
|
+
return {
|
|
13
|
+
toolbar: this.toolbarElement,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
activate() {
|
|
17
|
+
if (!this.canvasLayers['add']) {
|
|
18
|
+
this.createCanvasLayer('add', AddTextAnnotationLayer);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.removeCanvasLayer('add');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
TextAnnotationModule.moduleInfo = {
|
|
26
|
+
name: 'TextAnnotationModule',
|
|
27
|
+
moduleType: CanvasModuleType.Tool,
|
|
28
|
+
requiredFeatures: {
|
|
29
|
+
annotate: true,
|
|
30
|
+
fillFormFields: false,
|
|
31
|
+
},
|
|
32
|
+
translationKey: 'annotText.add',
|
|
33
|
+
icon: 'stickyNote',
|
|
34
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PdfViewing } from '@pdf-tools/four-heights-pdf-viewing';
|
|
2
|
+
export declare class ImageContainer {
|
|
3
|
+
private _imageBitmap;
|
|
4
|
+
private _imageData;
|
|
5
|
+
private _htmlCanvas;
|
|
6
|
+
constructor(image: PdfViewing.Pdf.Content.Image);
|
|
7
|
+
get scaledImage(): HTMLCanvasElement | ImageBitmap | null;
|
|
8
|
+
get imageData(): ImageData | null;
|
|
9
|
+
destroy(): void;
|
|
10
|
+
}
|