@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,181 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
11
|
+
import { PdfItemType, AnnotationBorderStyle, } from '../../pdf-viewer-api';
|
|
12
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
13
|
+
import { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';
|
|
14
|
+
import { createAddFreetextAnnotationToolbar } from './AddFreetextAnnotationToolbar';
|
|
15
|
+
const moduleLayerName = 'AddFreetextAnnotation';
|
|
16
|
+
export class AddFreetextAnnotationLayer extends CanvasLayer {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.context = null;
|
|
20
|
+
this.colors = [];
|
|
21
|
+
this.selectedColor = '';
|
|
22
|
+
this.borderWidths = [];
|
|
23
|
+
this.pointerDown = false;
|
|
24
|
+
this.startPoint = null;
|
|
25
|
+
this.page = 0;
|
|
26
|
+
}
|
|
27
|
+
onCreate() {
|
|
28
|
+
this.setColor = this.setColor.bind(this);
|
|
29
|
+
this.setBorderWidth = this.setBorderWidth.bind(this);
|
|
30
|
+
this.close = this.close.bind(this);
|
|
31
|
+
this.context = this.createCanvas();
|
|
32
|
+
this.colors = this.options.annotation.colors.backgroundColors;
|
|
33
|
+
this.selectedColor =
|
|
34
|
+
this.options.annotation.colors.freetextBackgroundColor ||
|
|
35
|
+
this.options.annotation.colors.defaultBackgroundColor;
|
|
36
|
+
// todo: get values from options
|
|
37
|
+
this.borderWidths = [0, 1, 2, 3, 4];
|
|
38
|
+
/* tslint:disable-next-line:align */
|
|
39
|
+
const toolbarElement = this.module.toolbarElement;
|
|
40
|
+
createAddFreetextAnnotationToolbar({
|
|
41
|
+
colors: this.colors,
|
|
42
|
+
selectedColor: this.selectedColor,
|
|
43
|
+
borderWidths: this.borderWidths,
|
|
44
|
+
selectedBorderWidth: this.options.annotation.freetextBorderWidth || this.options.annotation.defaultBorderWidth,
|
|
45
|
+
onColorChanged: this.setColor,
|
|
46
|
+
onBorderWidthChanged: this.setBorderWidth,
|
|
47
|
+
onClose: this.close,
|
|
48
|
+
}, toolbarElement);
|
|
49
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
50
|
+
}
|
|
51
|
+
onSave() {
|
|
52
|
+
const promise = new Promise((resolve, reject) => {
|
|
53
|
+
resolve();
|
|
54
|
+
});
|
|
55
|
+
return promise;
|
|
56
|
+
}
|
|
57
|
+
onRemove() {
|
|
58
|
+
this.removeCanvasElements();
|
|
59
|
+
this.context = null;
|
|
60
|
+
/* tslint:disable-next-line:align */
|
|
61
|
+
const toolbarElement = this.module.toolbarElement;
|
|
62
|
+
toolbarElement.innerHTML = '';
|
|
63
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
64
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
65
|
+
}
|
|
66
|
+
render(timestamp, state) {
|
|
67
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
68
|
+
this.remove();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (this.context) {
|
|
72
|
+
const update = state.viewer.modeChanged ||
|
|
73
|
+
state.pointer.positionChanged ||
|
|
74
|
+
state.pointer.action ||
|
|
75
|
+
state.document.zoomChanged;
|
|
76
|
+
if (update) {
|
|
77
|
+
const ctx = this.context;
|
|
78
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
79
|
+
const pointerPos = { x: state.pointer.x.devicePixels, y: state.pointer.y.devicePixels };
|
|
80
|
+
const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
|
|
81
|
+
if (pointerPdfPos.isOnPage) {
|
|
82
|
+
this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);
|
|
86
|
+
}
|
|
87
|
+
if (state.pointer.isDown) {
|
|
88
|
+
if (!this.pointerDown) {
|
|
89
|
+
this.startPoint = pointerPos;
|
|
90
|
+
this.pointerDown = true;
|
|
91
|
+
if (this.page === 0 && pointerPdfPos.isOnPage) {
|
|
92
|
+
this.page = pointerPdfPos.pdfPoint.page;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (this.startPoint) {
|
|
96
|
+
const rect = getRectFromSelection(state.document, {
|
|
97
|
+
x: this.startPoint.x,
|
|
98
|
+
y: this.startPoint.y,
|
|
99
|
+
}, {
|
|
100
|
+
x: pointerPos.x,
|
|
101
|
+
y: pointerPos.y,
|
|
102
|
+
}, this.page);
|
|
103
|
+
if (rect) {
|
|
104
|
+
const lineWidth = 2 * devicePixelRatio;
|
|
105
|
+
ctx.save();
|
|
106
|
+
ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
|
|
107
|
+
ctx.fillStyle = this.options.viewer.general.textSelectionColor;
|
|
108
|
+
ctx.lineWidth = lineWidth;
|
|
109
|
+
ctx.setLineDash([lineWidth, lineWidth]);
|
|
110
|
+
ctx.strokeRect(rect.x, rect.y, rect.w, rect.h);
|
|
111
|
+
ctx.globalAlpha = 0.33;
|
|
112
|
+
ctx.fillRect(rect.x, rect.y, rect.w, rect.h);
|
|
113
|
+
ctx.restore();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (this.pointerDown && this.startPoint) {
|
|
118
|
+
const rect = getRectFromSelection(state.document, {
|
|
119
|
+
x: this.startPoint.x,
|
|
120
|
+
y: this.startPoint.y,
|
|
121
|
+
}, {
|
|
122
|
+
x: pointerPos.x,
|
|
123
|
+
y: pointerPos.y,
|
|
124
|
+
}, this.page);
|
|
125
|
+
if (rect) {
|
|
126
|
+
this.createFreeTextAnnotation(rect);
|
|
127
|
+
this.pointerDown = false;
|
|
128
|
+
this.startPoint = null;
|
|
129
|
+
this.remove();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
setColor(color) {
|
|
136
|
+
this.selectedColor = color;
|
|
137
|
+
this.options.annotation.colors.freetextBackgroundColor = color;
|
|
138
|
+
}
|
|
139
|
+
setBorderWidth(borderWidth) {
|
|
140
|
+
this.options.annotation.freetextBorderWidth = borderWidth;
|
|
141
|
+
}
|
|
142
|
+
close() {
|
|
143
|
+
this.remove();
|
|
144
|
+
}
|
|
145
|
+
createFreeTextAnnotation(rect) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);
|
|
148
|
+
const { pdfY, pdfH, pdfW, pdfX, page } = pdfRect;
|
|
149
|
+
const pageSize = yield this.pdfApi.getPagePdfSize(page);
|
|
150
|
+
const minWidth = 20;
|
|
151
|
+
const minHeight = 18;
|
|
152
|
+
const isRotated = this.pdfApi.getRotation() % 180 !== 0;
|
|
153
|
+
pdfRect.pdfW = isRotated ? Math.max(minHeight, pdfW) : Math.max(minWidth, pdfW);
|
|
154
|
+
pdfRect.pdfH = isRotated ? Math.max(minWidth, pdfH) : Math.max(minHeight, pdfH);
|
|
155
|
+
pdfRect.pdfX = Math.min(pdfX, pageSize.width - pdfRect.pdfW);
|
|
156
|
+
pdfRect.pdfY = Math.min(pdfY, pageSize.height - pdfRect.pdfH);
|
|
157
|
+
const annotation = {
|
|
158
|
+
itemType: PdfItemType.FREE_TEXT,
|
|
159
|
+
color: this.selectedColor === 'transparent' ? '#00000000' : this.selectedColor,
|
|
160
|
+
author: this.options.viewer.general.user,
|
|
161
|
+
page: pdfRect.page,
|
|
162
|
+
pdfRect,
|
|
163
|
+
border: {
|
|
164
|
+
width: this.options.annotation.freetextBorderWidth || this.options.annotation.defaultBorderWidth,
|
|
165
|
+
style: AnnotationBorderStyle.SOLID,
|
|
166
|
+
},
|
|
167
|
+
/* tslint:disable-next-line: max-line-length */
|
|
168
|
+
richtext: `<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:19.12.0" xfa:spec="2.0.2" style="color:${this.options.annotation.colors.freetextFontColor};"></body>`,
|
|
169
|
+
fontName: 'Arial',
|
|
170
|
+
fontColor: this.options.annotation.fonts.freetextFontColor,
|
|
171
|
+
fontSize: this.options.annotation.fonts.freetextFontSize,
|
|
172
|
+
};
|
|
173
|
+
this.pdfApi.createItem(annotation).then((item) => {
|
|
174
|
+
this.onAnnotationCreated(item).then((item) => {
|
|
175
|
+
const module = this.module;
|
|
176
|
+
module.onEdit(item.id);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface AddFreetextAnnotationToolbarProps {
|
|
2
|
+
colors: string[];
|
|
3
|
+
selectedColor: string;
|
|
4
|
+
borderWidths: number[];
|
|
5
|
+
selectedBorderWidth: number;
|
|
6
|
+
onColorChanged(color: string): void;
|
|
7
|
+
onBorderWidthChanged(borderWidth: number): void;
|
|
8
|
+
onClose(): void;
|
|
9
|
+
}
|
|
10
|
+
interface AddFreetextAnnotationToolbarState {
|
|
11
|
+
colors: string[];
|
|
12
|
+
selectedColor: string;
|
|
13
|
+
borderWidths: number[];
|
|
14
|
+
selectedBorderWidth: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AddFreetextAnnotationToolbarActions {
|
|
17
|
+
setColor(color: string): AddFreetextAnnotationToolbarState;
|
|
18
|
+
setBorderWith(borderWidth: number): AddFreetextAnnotationToolbarState;
|
|
19
|
+
}
|
|
20
|
+
export declare const createAddFreetextAnnotationToolbar: (props: AddFreetextAnnotationToolbarProps, element: HTMLElement) => AddFreetextAnnotationToolbarActions;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { ColorPicker } from '../../common/ColorPicker';
|
|
9
|
+
import { StrokeWidthPicker } from '../../common/StrokeWidthPicker';
|
|
10
|
+
export const createAddFreetextAnnotationToolbar = (props, element) => {
|
|
11
|
+
const state = {
|
|
12
|
+
colors: props.colors,
|
|
13
|
+
selectedColor: props.selectedColor,
|
|
14
|
+
borderWidths: props.borderWidths,
|
|
15
|
+
selectedBorderWidth: props.selectedBorderWidth,
|
|
16
|
+
};
|
|
17
|
+
const actions = {
|
|
18
|
+
setColor: (color) => ($state) => {
|
|
19
|
+
props.onColorChanged(color);
|
|
20
|
+
return Object.assign(Object.assign({}, $state), { selectedColor: color });
|
|
21
|
+
},
|
|
22
|
+
setBorderWith: (borderWidth) => ($state) => {
|
|
23
|
+
props.onBorderWidthChanged(borderWidth);
|
|
24
|
+
return Object.assign(Object.assign({}, $state), { selectedBorderWidth: borderWidth });
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const App = () => h(AddFreetextAnnotationToolbar, null);
|
|
28
|
+
/* tslint:disable-next-line:max-line-length */
|
|
29
|
+
const AddFreetextAnnotationToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
30
|
+
h(ToolbarItemGroup, null,
|
|
31
|
+
h(ColorPicker, { colors: $state.colors, color: $state.selectedColor, icon: icons.fillColor, mode: "buttons", onChange: $actions.setColor }),
|
|
32
|
+
h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeText.borderWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.borderWidths, value: $state.selectedBorderWidth, onChange: $actions.setBorderWith })),
|
|
33
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
34
|
+
h(ToolbarSeparator, null),
|
|
35
|
+
h(ToolbarButton, { icon: icons.close, onClick: props.onClose }))));
|
|
36
|
+
return app(state, actions, App, element);
|
|
37
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
export declare class EditFreetextAnnotationLayer extends CanvasLayer {
|
|
4
|
+
private freetextAnnotation;
|
|
5
|
+
private editorElement;
|
|
6
|
+
private richTextEditor;
|
|
7
|
+
private toolbarView;
|
|
8
|
+
private color;
|
|
9
|
+
private fontSize;
|
|
10
|
+
private borderWidth;
|
|
11
|
+
private fontSizeCSS;
|
|
12
|
+
private fontName;
|
|
13
|
+
onCreate(annotationId: number): void;
|
|
14
|
+
onSave(): Promise<void>;
|
|
15
|
+
close(): void;
|
|
16
|
+
onRemove(): void;
|
|
17
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
18
|
+
private executeCommand;
|
|
19
|
+
private updateFreeTextAnnotation;
|
|
20
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { Color } from '../../common/Color';
|
|
3
|
+
import { createEditFreetextAnnotationToolbar, } from './EditFreetextAnnotationToolbar';
|
|
4
|
+
import { RichTextEditor } from './RichTextEditor';
|
|
5
|
+
import { convertPdfToCssPixel, convertCssToPdfPixel } from '../../common/Tools';
|
|
6
|
+
import { addHistoryEntry } from '../../custom/history';
|
|
7
|
+
const moduleLayerName = 'EditFreetextAnnotation';
|
|
8
|
+
export class EditFreetextAnnotationLayer extends CanvasLayer {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.freetextAnnotation = null;
|
|
12
|
+
this.editorElement = null;
|
|
13
|
+
this.richTextEditor = null;
|
|
14
|
+
this.toolbarView = null;
|
|
15
|
+
this.color = this.options.annotation.fonts.freetextFontColor;
|
|
16
|
+
this.fontSize = `${this.options.annotation.fonts.defaultFontSize}pt`;
|
|
17
|
+
this.borderWidth = 1;
|
|
18
|
+
this.fontSizeCSS = convertPdfToCssPixel(`${this.options.annotation.fonts.defaultFontSize}`);
|
|
19
|
+
this.fontName = this.options.annotation.fonts.freetextFontFamily;
|
|
20
|
+
}
|
|
21
|
+
onCreate(annotationId) {
|
|
22
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
23
|
+
this.freetextAnnotation = this.pdfApi.getItem(annotationId);
|
|
24
|
+
this.updateFreeTextAnnotation = this.updateFreeTextAnnotation.bind(this);
|
|
25
|
+
this.close = this.close.bind(this);
|
|
26
|
+
this.executeCommand = this.executeCommand.bind(this);
|
|
27
|
+
this.editorElement = this.createHtmlLayer();
|
|
28
|
+
this.editorElement.style.position = 'absolute';
|
|
29
|
+
this.editorElement.style.zIndex = '4';
|
|
30
|
+
const annotationOptions = this.options.annotation;
|
|
31
|
+
this.color = annotationOptions.colors.freetextFontColor;
|
|
32
|
+
this.borderWidth = this.freetextAnnotation.border.width;
|
|
33
|
+
this.fontName = annotationOptions.fonts.freetextFontFamily;
|
|
34
|
+
this.fontSize = `${annotationOptions.fonts.freetextFontSize}`;
|
|
35
|
+
this.fontSizeCSS = convertPdfToCssPixel(`${annotationOptions.fonts.freetextFontSize}`);
|
|
36
|
+
if (this.freetextAnnotation.richText) {
|
|
37
|
+
const colorRes = /.*color:(.*?);/.exec(this.freetextAnnotation.richText);
|
|
38
|
+
const fontNameRes = /.*font-family:(.*?);/.exec(this.freetextAnnotation.richText);
|
|
39
|
+
const fontSizeRes = /.*font-size:(.*?)[;|\"]/.exec(this.freetextAnnotation.richText);
|
|
40
|
+
if (colorRes && colorRes.length > 1) {
|
|
41
|
+
this.color = colorRes[1];
|
|
42
|
+
}
|
|
43
|
+
if (fontNameRes && fontNameRes.length > 1) {
|
|
44
|
+
this.fontName = fontNameRes[1];
|
|
45
|
+
}
|
|
46
|
+
if (fontSizeRes && fontSizeRes.length > 1) {
|
|
47
|
+
this.fontSize = fontSizeRes[1];
|
|
48
|
+
this.fontSizeCSS = convertPdfToCssPixel(this.fontSize);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.color = this.freetextAnnotation.color;
|
|
53
|
+
this.fontName = this.freetextAnnotation.fontName;
|
|
54
|
+
this.fontSizeCSS = convertPdfToCssPixel(this.freetextAnnotation.fontSize);
|
|
55
|
+
}
|
|
56
|
+
this.richTextEditor = new RichTextEditor(this.editorElement, {
|
|
57
|
+
content: this.freetextAnnotation.content,
|
|
58
|
+
richText: this.freetextAnnotation.richText,
|
|
59
|
+
backgroundColor: this.freetextAnnotation.color,
|
|
60
|
+
borderWidth: this.freetextAnnotation.border.width,
|
|
61
|
+
fontName: this.fontName,
|
|
62
|
+
fontColor: this.color,
|
|
63
|
+
fontSizeCSS: this.fontSizeCSS,
|
|
64
|
+
});
|
|
65
|
+
/* tslint:disable-next-line:align */
|
|
66
|
+
const toolbarElement = this.module.toolbarElement;
|
|
67
|
+
this.toolbarView = createEditFreetextAnnotationToolbar({
|
|
68
|
+
annotation: this.freetextAnnotation,
|
|
69
|
+
backgroundColors: [...annotationOptions.colors.backgroundColors],
|
|
70
|
+
borderWidths: [0, 1, 2, 3, 4],
|
|
71
|
+
fontColors: [...annotationOptions.colors.foregroundColors],
|
|
72
|
+
fontFamilies: annotationOptions.fonts.fontFamilies,
|
|
73
|
+
fontSizes: annotationOptions.fonts.fontSizes,
|
|
74
|
+
selectedFont: this.fontName,
|
|
75
|
+
selectedBackgroundColor: this.freetextAnnotation.color,
|
|
76
|
+
selectedFontColor: this.color,
|
|
77
|
+
selectedFontSize: this.fontSize,
|
|
78
|
+
selectedBorderWidth: this.borderWidth,
|
|
79
|
+
allowLockAnnotations: this.options.viewer.permissions.allowLockAnnotations,
|
|
80
|
+
hideAnnotationSubject: this.options.annotation.hideAnnotationSubject || false,
|
|
81
|
+
onCmd: this.executeCommand,
|
|
82
|
+
onClose: this.close,
|
|
83
|
+
}, toolbarElement);
|
|
84
|
+
}
|
|
85
|
+
onSave() {
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
87
|
+
this.updateFreeTextAnnotation().then(() => {
|
|
88
|
+
this.remove();
|
|
89
|
+
resolve();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
close() {
|
|
94
|
+
this.updateFreeTextAnnotation().then(() => {
|
|
95
|
+
this.remove();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
onRemove() {
|
|
99
|
+
this.removeHtmlElements();
|
|
100
|
+
this.editorElement = null;
|
|
101
|
+
this.freetextAnnotation = null;
|
|
102
|
+
/* tslint:disable-next-line:align */
|
|
103
|
+
const toolbarElement = this.module.toolbarElement;
|
|
104
|
+
toolbarElement.innerHTML = '';
|
|
105
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
106
|
+
}
|
|
107
|
+
render(timestamp, state) {
|
|
108
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
109
|
+
this.remove();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (this.editorElement && state.pointer.action === 'click') {
|
|
113
|
+
const insideHorizontal = state.pointer.x.cssPixels > this.editorElement.offsetLeft &&
|
|
114
|
+
state.pointer.x.cssPixels < this.editorElement.offsetLeft + this.editorElement.offsetWidth;
|
|
115
|
+
const insideVertical = state.pointer.y.cssPixels > this.editorElement.offsetTop &&
|
|
116
|
+
state.pointer.y.cssPixels < this.editorElement.offsetTop + this.editorElement.offsetHeight;
|
|
117
|
+
if (!insideHorizontal || !insideVertical) {
|
|
118
|
+
this.updateFreeTextAnnotation();
|
|
119
|
+
this.remove();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (this.editorElement && this.freetextAnnotation && this.richTextEditor) {
|
|
124
|
+
const updatePosition = state.canvas.canvasInvalidated || state.viewer.modeChanged;
|
|
125
|
+
if (updatePosition) {
|
|
126
|
+
const screenRect = this.pdfApi.transformPdfPageRectToScreenRect(this.freetextAnnotation.pdfRect);
|
|
127
|
+
this.editorElement.style.left = `${screenRect.x / devicePixelRatio}px`;
|
|
128
|
+
this.editorElement.style.top = `${screenRect.y / devicePixelRatio}px`;
|
|
129
|
+
const width = screenRect.w / devicePixelRatio;
|
|
130
|
+
const height = screenRect.h / devicePixelRatio;
|
|
131
|
+
const rotation = (this.freetextAnnotation.rotation + state.document.rotation) % 360;
|
|
132
|
+
this.editorElement.style.transform = `rotate(${rotation}deg)`;
|
|
133
|
+
if (rotation == 90) {
|
|
134
|
+
this.editorElement.style.width = `${height}px`;
|
|
135
|
+
this.editorElement.style.height = `${width}px`;
|
|
136
|
+
this.editorElement.style.transformOrigin = `${width / 2}px ${width / 2}px`;
|
|
137
|
+
}
|
|
138
|
+
else if (rotation == 180) {
|
|
139
|
+
this.editorElement.style.width = `${width}px`;
|
|
140
|
+
this.editorElement.style.height = `${height}px`;
|
|
141
|
+
this.editorElement.style.transformOrigin = `${width / 2}px ${height / 2}px`;
|
|
142
|
+
}
|
|
143
|
+
else if (rotation == 270) {
|
|
144
|
+
this.editorElement.style.width = `${height}px`;
|
|
145
|
+
this.editorElement.style.height = `${width}px`;
|
|
146
|
+
this.editorElement.style.transformOrigin = `${height / 2}px ${height / 2}px`;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.editorElement.style.width = `${width}px`;
|
|
150
|
+
this.editorElement.style.height = `${height}px`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (state.document.zoomChanged || state.viewer.modeChanged) {
|
|
154
|
+
this.richTextEditor.setZoom(state.document.zoom);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
executeCommand(cmd) {
|
|
159
|
+
var _a;
|
|
160
|
+
switch (cmd.cmd) {
|
|
161
|
+
case 'setFont': {
|
|
162
|
+
this.options.annotation.fonts.freetextFontFamily = cmd.args;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
case 'setFontSize': {
|
|
166
|
+
this.options.annotation.fonts.freetextFontSize = cmd.args;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
(_a = this.richTextEditor) === null || _a === void 0 ? void 0 : _a.executeCommand(cmd);
|
|
171
|
+
}
|
|
172
|
+
updateFreeTextAnnotation() {
|
|
173
|
+
const promise = new Promise((resolve, reject) => {
|
|
174
|
+
if (this.richTextEditor && this.freetextAnnotation) {
|
|
175
|
+
const richTextObj = this.richTextEditor.getEditorValues();
|
|
176
|
+
const subject = this.toolbarView
|
|
177
|
+
? this.toolbarView.getState().updatedSubject
|
|
178
|
+
: this.freetextAnnotation.subject;
|
|
179
|
+
if (this.options.annotation.trackHistory) {
|
|
180
|
+
addHistoryEntry(this.freetextAnnotation, 'edit', this.options.viewer.general.user, richTextObj.content, subject);
|
|
181
|
+
}
|
|
182
|
+
const fontColor = new Color(richTextObj.fontColor);
|
|
183
|
+
const backgroundColor = richTextObj.backgroundColor === ''
|
|
184
|
+
? null
|
|
185
|
+
: new Color(richTextObj.backgroundColor);
|
|
186
|
+
this.freetextAnnotation.content = richTextObj.content;
|
|
187
|
+
this.freetextAnnotation.subject = subject;
|
|
188
|
+
this.freetextAnnotation.richText = richTextObj.richText;
|
|
189
|
+
this.freetextAnnotation.fontColor = fontColor.toHexRgb();
|
|
190
|
+
this.freetextAnnotation.fontName =
|
|
191
|
+
richTextObj.fontName !== null ? richTextObj.fontName : 'Helvetica';
|
|
192
|
+
this.freetextAnnotation.fontSize = richTextObj.fontSizeCSS
|
|
193
|
+
? convertCssToPdfPixel(richTextObj.fontSizeCSS)
|
|
194
|
+
: this.freetextAnnotation.fontSize;
|
|
195
|
+
this.freetextAnnotation.color = backgroundColor !== null ? backgroundColor.toRgba() : null;
|
|
196
|
+
this.freetextAnnotation.border.width = richTextObj.borderWidth;
|
|
197
|
+
this.pdfApi
|
|
198
|
+
.updateItem(this.freetextAnnotation)
|
|
199
|
+
.then((item) => {
|
|
200
|
+
this.store.annotations.updateAnnotation(item);
|
|
201
|
+
resolve();
|
|
202
|
+
})
|
|
203
|
+
.catch((err) => {
|
|
204
|
+
console.error(err);
|
|
205
|
+
reject();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return promise;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ExecCommandArgs } from './RichTextEditor';
|
|
2
|
+
import { Annotation } from '../../pdf-viewer-api';
|
|
3
|
+
/** internal */
|
|
4
|
+
export interface EditFreetextAnnotationToolbarProps {
|
|
5
|
+
annotation: Annotation;
|
|
6
|
+
backgroundColors: string[];
|
|
7
|
+
borderWidths: number[];
|
|
8
|
+
selectedBorderWidth: number;
|
|
9
|
+
fontColors: string[];
|
|
10
|
+
fontFamilies: string[];
|
|
11
|
+
fontSizes: number[];
|
|
12
|
+
selectedFont: string;
|
|
13
|
+
selectedBackgroundColor: string;
|
|
14
|
+
selectedFontColor: string;
|
|
15
|
+
selectedFontSize: string;
|
|
16
|
+
allowLockAnnotations: boolean;
|
|
17
|
+
hideAnnotationSubject: boolean;
|
|
18
|
+
onCmd(cmd: ExecCommandArgs): void;
|
|
19
|
+
onClose(): void;
|
|
20
|
+
}
|
|
21
|
+
/** internal */
|
|
22
|
+
export interface EditFreetextAnnotationToolbarState {
|
|
23
|
+
annotation: Annotation;
|
|
24
|
+
updatedSubject: string | null;
|
|
25
|
+
backgroundColors: string[];
|
|
26
|
+
borderWidths: number[];
|
|
27
|
+
selectedBorderWidth: number;
|
|
28
|
+
fontColors: string[];
|
|
29
|
+
fontFamilies: string[];
|
|
30
|
+
fontSizes: number[];
|
|
31
|
+
selectedFont: string;
|
|
32
|
+
selectedBackgroundColor: string;
|
|
33
|
+
selectedFontColor: string;
|
|
34
|
+
selectedFontSize: string;
|
|
35
|
+
hasRangeSelection: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface EditFreetextAnnotationToolbarActions {
|
|
38
|
+
getState(): EditFreetextAnnotationToolbarState;
|
|
39
|
+
executeCommand(cmd: ExecCommandArgs): EditFreetextAnnotationToolbarState;
|
|
40
|
+
setBorderWith(borderWidth: number): EditFreetextAnnotationToolbarState;
|
|
41
|
+
setFontFamily(fontName: string): EditFreetextAnnotationToolbarState;
|
|
42
|
+
setFontSize(fontSize: number): EditFreetextAnnotationToolbarState;
|
|
43
|
+
setFontColor(color: string): EditFreetextAnnotationToolbarState;
|
|
44
|
+
setBackgroundColor(color: string): EditFreetextAnnotationToolbarState;
|
|
45
|
+
hasRangeSelectionChanged(hasRangeSelection: boolean): EditFreetextAnnotationToolbarState;
|
|
46
|
+
setSubject(subject: string | null): EditFreetextAnnotationToolbarState;
|
|
47
|
+
close(): EditFreetextAnnotationToolbarState;
|
|
48
|
+
}
|
|
49
|
+
/** internal */
|
|
50
|
+
export declare const createEditFreetextAnnotationToolbar: (props: EditFreetextAnnotationToolbarProps, element: HTMLElement) => EditFreetextAnnotationToolbarActions;
|
|
@@ -0,0 +1,118 @@
|
|
|
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 { Dropdown } from '../../common/Dropdown';
|
|
7
|
+
import { ColorPicker } from '../../common/ColorPicker';
|
|
8
|
+
import { icons } from '../../common/icons';
|
|
9
|
+
import { ToolbarSeparator } from '../../common/ToolbarSeparator';
|
|
10
|
+
import { StrokeWidthPicker } from '../../common/StrokeWidthPicker';
|
|
11
|
+
/** internal */
|
|
12
|
+
export const createEditFreetextAnnotationToolbar = (props, element) => {
|
|
13
|
+
const state = {
|
|
14
|
+
annotation: props.annotation,
|
|
15
|
+
updatedSubject: props.annotation.subject,
|
|
16
|
+
backgroundColors: props.backgroundColors,
|
|
17
|
+
borderWidths: props.borderWidths,
|
|
18
|
+
selectedBorderWidth: props.selectedBorderWidth,
|
|
19
|
+
fontColors: props.fontColors,
|
|
20
|
+
fontFamilies: props.fontFamilies,
|
|
21
|
+
fontSizes: props.fontSizes,
|
|
22
|
+
selectedFont: props.selectedFont,
|
|
23
|
+
selectedBackgroundColor: props.selectedBackgroundColor,
|
|
24
|
+
selectedFontColor: props.selectedFontColor,
|
|
25
|
+
selectedFontSize: props.selectedFontSize,
|
|
26
|
+
hasRangeSelection: false,
|
|
27
|
+
};
|
|
28
|
+
const actions = {
|
|
29
|
+
getState: () => ($state) => $state,
|
|
30
|
+
setBorderWith: (borderWidth) => ($state) => {
|
|
31
|
+
// props.onBorderWidthChanged(borderWidth)
|
|
32
|
+
props.onCmd({ cmd: 'setBorderWidth', args: borderWidth });
|
|
33
|
+
return Object.assign(Object.assign({}, $state), { selectedBorderWidth: borderWidth });
|
|
34
|
+
},
|
|
35
|
+
executeCommand: (cmd) => ($state) => {
|
|
36
|
+
props.onCmd(cmd);
|
|
37
|
+
return $state;
|
|
38
|
+
},
|
|
39
|
+
setFontFamily: (fontName) => ($state) => {
|
|
40
|
+
props.onCmd({ cmd: 'setFont', args: fontName });
|
|
41
|
+
return Object.assign(Object.assign({}, $state), { selectedFont: fontName });
|
|
42
|
+
},
|
|
43
|
+
setFontSize: (fontSize) => ($state) => {
|
|
44
|
+
props.onCmd({ cmd: 'setFontSize', args: fontSize });
|
|
45
|
+
return Object.assign(Object.assign({}, $state), { selectedFontSize: `${fontSize}pt` });
|
|
46
|
+
},
|
|
47
|
+
setFontColor: (color) => ($state) => {
|
|
48
|
+
props.onCmd({ cmd: 'setFontColor', args: color });
|
|
49
|
+
return Object.assign(Object.assign({}, $state), { selectedFontColor: color });
|
|
50
|
+
},
|
|
51
|
+
setBackgroundColor: (color) => ($state) => {
|
|
52
|
+
props.onCmd({ cmd: 'setFillColor', args: color });
|
|
53
|
+
return Object.assign(Object.assign({}, $state), { selectedBackgroundColor: color });
|
|
54
|
+
},
|
|
55
|
+
setSubject: (subject) => ($state) => {
|
|
56
|
+
return Object.assign(Object.assign({}, $state), { annotation: $state.annotation, updatedSubject: subject });
|
|
57
|
+
},
|
|
58
|
+
hasRangeSelectionChanged: (hasRangeSelection) => ($state) => (Object.assign(Object.assign({}, $state), { hasRangeSelection })),
|
|
59
|
+
close: () => ($state) => {
|
|
60
|
+
props.onClose();
|
|
61
|
+
return $state;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const App = () => (h(EditFreetextAnnotationToolbar, { hideAnnotationSubject: props.hideAnnotationSubject }));
|
|
65
|
+
/* tslint:disable-next-line:max-line-length */
|
|
66
|
+
const EditFreetextAnnotationToolbar = ({ hideAnnotationSubject }) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
|
|
67
|
+
h(ToolbarItemGroup, null,
|
|
68
|
+
h(Dropdown, { tooltip: translationManager.getText('annotFreeText.fontFamily'), text: $state.selectedFont, value: $state.selectedFont, width: 150, items: $state.fontFamilies.map((font) => ({
|
|
69
|
+
text: font,
|
|
70
|
+
value: font,
|
|
71
|
+
})), onChange: $actions.setFontFamily }),
|
|
72
|
+
h(Dropdown, { tooltip: translationManager.getText('annotFreeText.fontSize'), text: $state.selectedFontSize, value: $state.selectedFontSize, width: 85, align: "right", items: $state.fontSizes.map((size, index) => ({
|
|
73
|
+
text: `${size}pt`,
|
|
74
|
+
value: size,
|
|
75
|
+
})), onChange: $actions.setFontSize }),
|
|
76
|
+
h(ToolbarSeparator, null)),
|
|
77
|
+
h(ToolbarItemGroup, null,
|
|
78
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotFreeText.fontColor'), colors: $state.fontColors, icon: icons.fontColor, color: $state.selectedFontColor, onChange: $actions.setFontColor }),
|
|
79
|
+
h(ColorPicker, { tooltip: translationManager.getText('annotFreeText.bgColor'), colors: $state.backgroundColors, icon: icons.fillColor, color: $state.selectedBackgroundColor, onChange: $actions.setBackgroundColor }),
|
|
80
|
+
h(StrokeWidthPicker, { tooltip: translationManager.getText('annotFreeText.borderWidth'), noneStrokeText: translationManager.getText('border.none'), strokeWidths: $state.borderWidths, value: $state.selectedBorderWidth, onChange: $actions.setBorderWith }),
|
|
81
|
+
h(ToolbarSeparator, null)),
|
|
82
|
+
h(ToolbarItemGroup, null,
|
|
83
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignLeft'), icon: icons.alignLeft, onClick: () => {
|
|
84
|
+
$actions.executeCommand({ cmd: 'justifyLeft' });
|
|
85
|
+
} }),
|
|
86
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignCenter'), icon: icons.alignCenter, onClick: () => {
|
|
87
|
+
$actions.executeCommand({ cmd: 'justifyCenter' });
|
|
88
|
+
} }),
|
|
89
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.alignRight'), icon: icons.alignRight, onClick: () => {
|
|
90
|
+
$actions.executeCommand({ cmd: 'justifyRight' });
|
|
91
|
+
} }),
|
|
92
|
+
h(ToolbarSeparator, null)),
|
|
93
|
+
h(ToolbarItemGroup, null,
|
|
94
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.bold'), icon: icons.bold, onClick: () => {
|
|
95
|
+
$actions.executeCommand({ cmd: 'bold' });
|
|
96
|
+
} }),
|
|
97
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.italic'), icon: icons.italic, onClick: () => {
|
|
98
|
+
$actions.executeCommand({ cmd: 'italic' });
|
|
99
|
+
} }),
|
|
100
|
+
h(ToolbarButton, { tooltip: translationManager.getText('annotFreeText.underline'), icon: icons.underline, onClick: () => {
|
|
101
|
+
$actions.executeCommand({ cmd: 'underline' });
|
|
102
|
+
} }),
|
|
103
|
+
h(ToolbarSeparator, null)),
|
|
104
|
+
props.allowLockAnnotations && (h(ToolbarItemGroup, null,
|
|
105
|
+
h(ToolbarButton, { tooltip: translationManager.getText($state.annotation.isLocked() ? 'annotFreeText.unlock' : 'annotFreeText.lock'), icon: $state.annotation.isLocked() ? icons.lock : icons.unlock, onClick: () => {
|
|
106
|
+
$state.annotation.setLock(!$state.annotation.isLocked());
|
|
107
|
+
$actions.close();
|
|
108
|
+
} }),
|
|
109
|
+
h(ToolbarSeparator, null))),
|
|
110
|
+
!hideAnnotationSubject && (h(ToolbarItemGroup, null,
|
|
111
|
+
h("div", { class: 'pwv-freetext-subject' },
|
|
112
|
+
h("input", { id: 'pwv-freetext-subject-' + $state.annotation.id, placeholder: translationManager.getText('annotFreeText.subjectPlaceholder'), onchange: (e) => {
|
|
113
|
+
$actions.setSubject(e.currentTarget.value);
|
|
114
|
+
}, value: $state.updatedSubject })))),
|
|
115
|
+
h(ToolbarItemGroup, { pushRight: true },
|
|
116
|
+
h(ToolbarButton, { icon: icons.ok, onClick: $actions.close }))));
|
|
117
|
+
return app(state, actions, App, element);
|
|
118
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
3
|
+
export declare class FreetextAnnotationModule extends CanvasModule {
|
|
4
|
+
annotationbarElement: HTMLElement | null;
|
|
5
|
+
toolbarElement: HTMLElement | null;
|
|
6
|
+
static moduleInfo: {
|
|
7
|
+
name: string;
|
|
8
|
+
moduleType: CanvasModuleType;
|
|
9
|
+
requiredFeatures: {
|
|
10
|
+
annotate: boolean;
|
|
11
|
+
fillFormFields: boolean;
|
|
12
|
+
};
|
|
13
|
+
translationKey: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
constructor();
|
|
17
|
+
onRegister(): {
|
|
18
|
+
toolbar: HTMLElement;
|
|
19
|
+
contextbar: {
|
|
20
|
+
itemTypes: PdfItemType[];
|
|
21
|
+
icon: import("../../common/icons").IconDefinition;
|
|
22
|
+
tooltip: string;
|
|
23
|
+
onCmd: (annotationId: number) => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
activate(annotationId: number): void;
|
|
27
|
+
onEdit(annotationId: number): void;
|
|
28
|
+
}
|