@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,58 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { AddFreetextAnnotationLayer } from './AddFreetextAnnotationLayer';
|
|
3
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
4
|
+
import { icons } from '../../common/Icon';
|
|
5
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
6
|
+
import { EditFreetextAnnotationLayer } from './EditFreetextAnnotationLayer';
|
|
7
|
+
export class FreetextAnnotationModule extends CanvasModule {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.annotationbarElement = null;
|
|
11
|
+
this.toolbarElement = null;
|
|
12
|
+
this.name = FreetextAnnotationModule.moduleInfo.name;
|
|
13
|
+
this.onEdit = this.onEdit.bind(this);
|
|
14
|
+
}
|
|
15
|
+
onRegister() {
|
|
16
|
+
this.toolbarElement = document.createElement('div');
|
|
17
|
+
return {
|
|
18
|
+
toolbar: this.toolbarElement,
|
|
19
|
+
contextbar: {
|
|
20
|
+
itemTypes: [PdfItemType.FREE_TEXT],
|
|
21
|
+
icon: icons.edit,
|
|
22
|
+
tooltip: translationManager.getText('annotFreeText.edit'),
|
|
23
|
+
onCmd: (annotationId) => {
|
|
24
|
+
this.onEdit(annotationId);
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
activate(annotationId) {
|
|
30
|
+
if (annotationId) {
|
|
31
|
+
this.onEdit(annotationId);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (!this.canvasLayers['add']) {
|
|
35
|
+
if (this.store) {
|
|
36
|
+
this.store.viewer.deselectAnnotation();
|
|
37
|
+
}
|
|
38
|
+
this.createCanvasLayer('add', AddFreetextAnnotationLayer);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.removeCanvasLayer('add');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
onEdit(annotationId) {
|
|
46
|
+
this.createCanvasLayer('edit', EditFreetextAnnotationLayer, annotationId);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
FreetextAnnotationModule.moduleInfo = {
|
|
50
|
+
name: 'FreetextAnnotationModule',
|
|
51
|
+
moduleType: CanvasModuleType.Tool,
|
|
52
|
+
requiredFeatures: {
|
|
53
|
+
annotate: true,
|
|
54
|
+
fillFormFields: false,
|
|
55
|
+
},
|
|
56
|
+
translationKey: 'annotFreeText.add',
|
|
57
|
+
icon: 'freeText',
|
|
58
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** internal */
|
|
2
|
+
export interface ExecCommandArgs {
|
|
3
|
+
cmd: string;
|
|
4
|
+
args?: any;
|
|
5
|
+
}
|
|
6
|
+
/** internal */
|
|
7
|
+
export interface RichTextEditorContent {
|
|
8
|
+
richText: string;
|
|
9
|
+
content: string;
|
|
10
|
+
backgroundColor: string | null;
|
|
11
|
+
borderWidth: number;
|
|
12
|
+
fontName: string | null;
|
|
13
|
+
fontColor: string | null;
|
|
14
|
+
fontSizeCSS: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** internal */
|
|
17
|
+
export declare class RichTextEditor {
|
|
18
|
+
private element;
|
|
19
|
+
private editorElement;
|
|
20
|
+
private editorDocument;
|
|
21
|
+
private content;
|
|
22
|
+
private hasRangeSelection;
|
|
23
|
+
constructor(element: HTMLElement, content: RichTextEditorContent);
|
|
24
|
+
setZoom(zoom: number): void;
|
|
25
|
+
getEditorValues(): RichTextEditorContent;
|
|
26
|
+
executeCommand(cmd: ExecCommandArgs): void;
|
|
27
|
+
private cleanupRichText;
|
|
28
|
+
private getContent;
|
|
29
|
+
private handleOnPaste;
|
|
30
|
+
private handleSelectionChange;
|
|
31
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { Color } from '../../common/Color';
|
|
2
|
+
import { convertPdfToCssPixel, roundToTwo } from '../../common/Tools';
|
|
3
|
+
/** internal */
|
|
4
|
+
export class RichTextEditor {
|
|
5
|
+
constructor(element, content) {
|
|
6
|
+
this.hasRangeSelection = false;
|
|
7
|
+
// bind events
|
|
8
|
+
this.executeCommand = this.executeCommand.bind(this);
|
|
9
|
+
this.handleOnPaste = this.handleOnPaste.bind(this);
|
|
10
|
+
this.handleSelectionChange = this.handleSelectionChange.bind(this);
|
|
11
|
+
this.content = content;
|
|
12
|
+
// create elements
|
|
13
|
+
this.element = element;
|
|
14
|
+
this.element.style.background = 'white';
|
|
15
|
+
this.element.classList.add('pwv-freetexteditor');
|
|
16
|
+
this.editorElement = document.createElement('iframe');
|
|
17
|
+
this.editorElement.width = '100%';
|
|
18
|
+
this.editorElement.height = '100%';
|
|
19
|
+
this.editorElement.frameBorder = '0';
|
|
20
|
+
this.editorElement.style.transformOrigin = '0 0';
|
|
21
|
+
this.element.appendChild(this.editorElement);
|
|
22
|
+
this.editorDocument = this.editorElement.contentDocument;
|
|
23
|
+
this.editorDocument.open();
|
|
24
|
+
this.editorDocument.close();
|
|
25
|
+
// set content
|
|
26
|
+
let text = content.richText;
|
|
27
|
+
text = text.replace(/\&#(10|13|x0A|x0D);/gi, '<br>');
|
|
28
|
+
text = text.replace(/<p\s*([^>]*)>/gi, '<div $1>');
|
|
29
|
+
text = text.replace(/<\/p>\s*<br\/*>/gi, '</div>');
|
|
30
|
+
text = text.replace(/<br\/*>\s*<\/p>\s*/gi, '</div>');
|
|
31
|
+
text = text.replace(/<\/p>/gi, '</div>');
|
|
32
|
+
text = text.replace(/\r?\n|\r/g, '');
|
|
33
|
+
const m = /.*(<body.*<\/body>).*/gi.exec(text);
|
|
34
|
+
/* tslint:disable:max-line-length */
|
|
35
|
+
this.editorDocument.body.outerHTML =
|
|
36
|
+
m && m.length > 1
|
|
37
|
+
? m[1]
|
|
38
|
+
: '<?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"><p></p></body>';
|
|
39
|
+
if (this.editorDocument.body.children.length === 0) {
|
|
40
|
+
if (this.editorDocument.body.childNodes.length === 1 &&
|
|
41
|
+
this.editorDocument.body.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
42
|
+
this.editorDocument.body.innerHTML = `<p>${this.editorDocument.body.childNodes[0].textContent}</p>`;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.editorDocument.body.innerHTML = '<div><br/></div>';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.editorDocument.body.childNodes.forEach((node) => {
|
|
50
|
+
if (node.nodeName === 'DIV' && node.childNodes.length === 0) {
|
|
51
|
+
const br = document.createElement('br');
|
|
52
|
+
node.appendChild(br);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
this.editorDocument.body.addEventListener('input', (e) => {
|
|
57
|
+
if (this.editorDocument.body.innerHTML === '' ||
|
|
58
|
+
this.editorDocument.body.innerHTML === '<br>') {
|
|
59
|
+
this.editorDocument.body.innerHTML = '<div><br/></div>';
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
this.editorDocument.body.addEventListener('keydown', (e) => {
|
|
63
|
+
if (e.key === 'Tab') {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
}
|
|
66
|
+
else if (e.key === 'Enter') {
|
|
67
|
+
this.editorDocument.execCommand('formatBlock', false, 'div');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
this.editorDocument.head.insertAdjacentHTML('beforeend', `<style>
|
|
71
|
+
body {
|
|
72
|
+
padding: 1px;
|
|
73
|
+
line-height: 1.2;
|
|
74
|
+
margin: 0;
|
|
75
|
+
height: 100%;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
white-space: pre-wrap:
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
p {
|
|
81
|
+
margin: 0;
|
|
82
|
+
}
|
|
83
|
+
</style>`);
|
|
84
|
+
this.editorDocument.body.style.fontFamily = content.fontName;
|
|
85
|
+
this.editorDocument.body.style.color = content.fontColor;
|
|
86
|
+
this.editorDocument.body.style.fontSize = content.fontSizeCSS;
|
|
87
|
+
this.editorDocument.body.style.backgroundColor = content.backgroundColor;
|
|
88
|
+
this.editorDocument.body.style.borderColor = '#000000';
|
|
89
|
+
this.editorDocument.body.style.borderStyle = 'solid';
|
|
90
|
+
this.editorDocument.body.style.borderWidth = `${content.borderWidth}px`;
|
|
91
|
+
this.editorDocument.designMode = 'on';
|
|
92
|
+
// this.editorDocument.execCommand('defaultParagraphSeparator', false, 'div')
|
|
93
|
+
// add event listeners
|
|
94
|
+
this.editorDocument.addEventListener('paste', this.handleOnPaste, false);
|
|
95
|
+
this.editorDocument.addEventListener('selectionchange', this.handleSelectionChange, false);
|
|
96
|
+
this.editorDocument.addEventListener('mousewheel', (e) => {
|
|
97
|
+
e.preventDefault();
|
|
98
|
+
e.cancelBubble = true;
|
|
99
|
+
}, { passive: false });
|
|
100
|
+
this.editorDocument.body.setAttribute('tabindex', '1');
|
|
101
|
+
window.setTimeout(() => {
|
|
102
|
+
var _a;
|
|
103
|
+
let range = this.editorDocument.createRange();
|
|
104
|
+
range.setStart(this.editorDocument.body, 0);
|
|
105
|
+
range.setEnd(this.editorDocument.body, this.editorDocument.body.children.length);
|
|
106
|
+
range.collapse();
|
|
107
|
+
(_a = this.editorDocument.getSelection()) === null || _a === void 0 ? void 0 : _a.addRange(range);
|
|
108
|
+
this.editorDocument.body.focus();
|
|
109
|
+
}, 1);
|
|
110
|
+
}
|
|
111
|
+
setZoom(zoom) {
|
|
112
|
+
this.editorElement.style.transform = `scale(${zoom})`;
|
|
113
|
+
this.editorElement.width = this.element.clientWidth / zoom + 'px';
|
|
114
|
+
this.editorElement.height = this.element.clientHeight / zoom + 'px';
|
|
115
|
+
}
|
|
116
|
+
getEditorValues() {
|
|
117
|
+
const richText = '<?xml version="1.0"?>' + this.cleanupRichText(this.editorDocument.body.outerHTML);
|
|
118
|
+
const pureContent = this.getContent(richText);
|
|
119
|
+
return Object.assign(Object.assign({}, this.content), { content: pureContent ? pureContent : '', backgroundColor: this.editorDocument.body.style.backgroundColor, fontColor: this.editorDocument.body.style.color, fontName: this.editorDocument.body.style.fontFamily, fontSizeCSS: this.editorDocument.body.style.fontSize, richText });
|
|
120
|
+
}
|
|
121
|
+
executeCommand(cmd) {
|
|
122
|
+
switch (cmd.cmd) {
|
|
123
|
+
case 'setFont': {
|
|
124
|
+
this.content.fontName = cmd.args;
|
|
125
|
+
this.editorDocument.body.style.fontFamily = cmd.args;
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case 'setFontColor': {
|
|
129
|
+
this.content.fontColor = cmd.args;
|
|
130
|
+
this.editorDocument.body.style.color = cmd.args;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case 'setBorderWidth': {
|
|
134
|
+
this.content.borderWidth = cmd.args;
|
|
135
|
+
this.editorDocument.body.style.borderWidth = `${cmd.args}px`;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 'setFontSize': {
|
|
139
|
+
const size = convertPdfToCssPixel(cmd.args);
|
|
140
|
+
this.content.fontSizeCSS = size;
|
|
141
|
+
this.editorDocument.body.style.fontSize = size;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case 'setFillColor': {
|
|
145
|
+
this.content.backgroundColor = cmd.args;
|
|
146
|
+
this.editorDocument.body.style.backgroundColor = cmd.args;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
default: {
|
|
150
|
+
this.editorDocument.execCommand(cmd.cmd, false, cmd.args);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
cleanupRichText(richText) {
|
|
155
|
+
let text = richText;
|
|
156
|
+
text = text.replace(/<div><br><\/div>/gi, ' ');
|
|
157
|
+
text = text.replace(/<div\s*([^>]*)\>/gi, '<p $1>');
|
|
158
|
+
text = text.replace(/<\/div\>/gi, '</p> ');
|
|
159
|
+
text = text.replace(/<p\s*>/gi, '<p>');
|
|
160
|
+
text = text.replace(/\<br\>/gi, ' ');
|
|
161
|
+
text = text.replace(/(\n|\r)/gi, '');
|
|
162
|
+
// const underline = /<u>/gi
|
|
163
|
+
// const found = text.match(underline) // find underline tags
|
|
164
|
+
// if (found && found.length > 0) {
|
|
165
|
+
// // if they exist remove them
|
|
166
|
+
// text = text.replace(/<\/?u>/gi, '')
|
|
167
|
+
// text = text.replace(/style=\"/gi, 'style="text-decoration:underline') // set text-decoration instead
|
|
168
|
+
// }
|
|
169
|
+
text = text.replace(/<u>/gi, '<span style="text-decoration:underline;">');
|
|
170
|
+
text = text.replace(/<\/u>/gi, '</span>');
|
|
171
|
+
text = text.replace(/\ \;/gi, ' '); // remove non breaking space
|
|
172
|
+
text = text.replace(/overflow\:.*?\;/gi, ''); // remove: overflow:...;
|
|
173
|
+
text = text.replace(/background-color\:.*?\;/gi, ''); // remove background-color:...;
|
|
174
|
+
text = text.replace(/border\:.*?\;/gi, ''); // remove border:...;
|
|
175
|
+
text = text.replace(/border-color\:.*?\;/gi, ''); // remove border-color:...;
|
|
176
|
+
text = text.replace(/border-style\:.*?\;/gi, ''); // remove border-style:...;
|
|
177
|
+
text = text.replace(/border-width\:.*?\;/gi, ''); // remove border-width:...;
|
|
178
|
+
text = text.replace(/font-size\:\s*(\d*\.?\d+)px\s*\;/gi, (_, size) => {
|
|
179
|
+
size = parseFloat(size);
|
|
180
|
+
// calculate font size in pdf units
|
|
181
|
+
size = roundToTwo((size / 96) * 72);
|
|
182
|
+
return 'font-size:' + size + 'pt;';
|
|
183
|
+
});
|
|
184
|
+
text = text.replace(/rgb\((.+?)\)/gi, (rgb) => {
|
|
185
|
+
return new Color(rgb).toHexRgb();
|
|
186
|
+
});
|
|
187
|
+
// remove spaces within the styles tag
|
|
188
|
+
text = text.replace(/style="(.*?)"/gi, (styles) => {
|
|
189
|
+
return styles.replace(/\s*/gi, '');
|
|
190
|
+
});
|
|
191
|
+
return text;
|
|
192
|
+
}
|
|
193
|
+
getContent(richText) {
|
|
194
|
+
const parser = new DOMParser();
|
|
195
|
+
const node = parser.parseFromString(richText, 'text/html').documentElement;
|
|
196
|
+
let nodes = node ? node.querySelector('*') : null;
|
|
197
|
+
if (nodes) {
|
|
198
|
+
while (true) {
|
|
199
|
+
nodes = nodes.nextSibling;
|
|
200
|
+
if (nodes) {
|
|
201
|
+
if (nodes.nodeName.toLocaleLowerCase() === 'body') {
|
|
202
|
+
return nodes.innerText;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
handleOnPaste(e) {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
const text = e.clipboardData.getData('text/plain');
|
|
215
|
+
if (text) {
|
|
216
|
+
this.executeCommand({
|
|
217
|
+
cmd: 'insertText',
|
|
218
|
+
args: text,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
handleSelectionChange(e) { }
|
|
223
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
export declare enum HighlightTool {
|
|
4
|
+
HIGHLIGHT = 0,
|
|
5
|
+
RECTANGULAR_HIGHLIGHT = 1,
|
|
6
|
+
UNDERLINE = 2,
|
|
7
|
+
SQUIGGLY = 3,
|
|
8
|
+
STRIKE_OUT = 4
|
|
9
|
+
}
|
|
10
|
+
export declare class AddHighlightAnnotationLayer extends CanvasLayer {
|
|
11
|
+
private context;
|
|
12
|
+
private colors;
|
|
13
|
+
private selectedColor;
|
|
14
|
+
private selectedTool;
|
|
15
|
+
private pdfStartPoint;
|
|
16
|
+
private screenStartPoint;
|
|
17
|
+
private pointerDown;
|
|
18
|
+
private page;
|
|
19
|
+
private selecting;
|
|
20
|
+
private selection;
|
|
21
|
+
onCreate(): void;
|
|
22
|
+
onSave(): Promise<void>;
|
|
23
|
+
onRemove(): void;
|
|
24
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
25
|
+
private setColor;
|
|
26
|
+
private setTool;
|
|
27
|
+
private close;
|
|
28
|
+
private getPdfItemTypeForTool;
|
|
29
|
+
private createRectangularHighlightAnnotation;
|
|
30
|
+
private createHighlightAnnotation;
|
|
31
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { PdfItemType, } from '../../pdf-viewer-api';
|
|
3
|
+
import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
|
|
4
|
+
import { renderTextSelection } from '../../pdf-viewer-canvas/view-layers/canvasShapes';
|
|
5
|
+
import { Color } from '../../common/Color';
|
|
6
|
+
import { createAddHighlightAnnotationToolbar } from './AddHighlightAnnotationToolbar';
|
|
7
|
+
import { getRectFromSelection } from '../../pdf-viewer-canvas/state/document';
|
|
8
|
+
export var HighlightTool;
|
|
9
|
+
(function (HighlightTool) {
|
|
10
|
+
HighlightTool[HighlightTool["HIGHLIGHT"] = 0] = "HIGHLIGHT";
|
|
11
|
+
HighlightTool[HighlightTool["RECTANGULAR_HIGHLIGHT"] = 1] = "RECTANGULAR_HIGHLIGHT";
|
|
12
|
+
HighlightTool[HighlightTool["UNDERLINE"] = 2] = "UNDERLINE";
|
|
13
|
+
HighlightTool[HighlightTool["SQUIGGLY"] = 3] = "SQUIGGLY";
|
|
14
|
+
HighlightTool[HighlightTool["STRIKE_OUT"] = 4] = "STRIKE_OUT";
|
|
15
|
+
})(HighlightTool || (HighlightTool = {}));
|
|
16
|
+
const moduleLayerName = 'AddHighlightAnnotation';
|
|
17
|
+
export class AddHighlightAnnotationLayer extends CanvasLayer {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.colors = [];
|
|
21
|
+
this.selectedColor = '';
|
|
22
|
+
this.selectedTool = HighlightTool.HIGHLIGHT;
|
|
23
|
+
this.pdfStartPoint = null;
|
|
24
|
+
this.screenStartPoint = null;
|
|
25
|
+
this.pointerDown = false;
|
|
26
|
+
this.page = 0;
|
|
27
|
+
this.selecting = false;
|
|
28
|
+
this.selection = null;
|
|
29
|
+
}
|
|
30
|
+
onCreate() {
|
|
31
|
+
this.setColor = this.setColor.bind(this);
|
|
32
|
+
this.close = this.close.bind(this);
|
|
33
|
+
this.setTool = this.setTool.bind(this);
|
|
34
|
+
this.context = this.createCanvas();
|
|
35
|
+
const annotationOptions = this.options.annotation;
|
|
36
|
+
this.colors = annotationOptions.colors.highlightColors;
|
|
37
|
+
this.selectedColor = annotationOptions.colors.highlightAnnotationColor;
|
|
38
|
+
/* tslint:disable-next-line:align */
|
|
39
|
+
const toolbarElement = this.module.toolbarElement;
|
|
40
|
+
createAddHighlightAnnotationToolbar({
|
|
41
|
+
colors: this.colors,
|
|
42
|
+
selectedColor: this.selectedColor,
|
|
43
|
+
selectedTool: this.selectedTool,
|
|
44
|
+
onColorChanged: this.setColor,
|
|
45
|
+
onToolChanged: this.setTool,
|
|
46
|
+
onClose: this.close,
|
|
47
|
+
}, toolbarElement);
|
|
48
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
49
|
+
}
|
|
50
|
+
onSave() {
|
|
51
|
+
const promise = new Promise((resolve, reject) => {
|
|
52
|
+
resolve();
|
|
53
|
+
});
|
|
54
|
+
return promise;
|
|
55
|
+
}
|
|
56
|
+
onRemove() {
|
|
57
|
+
this.removeCanvasElements();
|
|
58
|
+
this.context = null;
|
|
59
|
+
/* tslint:disable-next-line:align */
|
|
60
|
+
const toolbarElement = this.module.toolbarElement;
|
|
61
|
+
toolbarElement.innerHTML = '';
|
|
62
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
63
|
+
}
|
|
64
|
+
render(timestamp, state) {
|
|
65
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
66
|
+
this.remove();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (this.context) {
|
|
70
|
+
if (this.selectedTool === HighlightTool.RECTANGULAR_HIGHLIGHT) {
|
|
71
|
+
const ctx = this.context;
|
|
72
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
73
|
+
const pointerPos = {
|
|
74
|
+
x: state.pointer.x.devicePixels,
|
|
75
|
+
y: state.pointer.y.devicePixels,
|
|
76
|
+
};
|
|
77
|
+
const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
|
|
78
|
+
if (pointerPdfPos.isOnPage) {
|
|
79
|
+
this.store.viewer.setCursorStyle(CursorStyle.CROSSHAIR);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.store.viewer.setCursorStyle(CursorStyle.NOT_ALLOWED);
|
|
83
|
+
}
|
|
84
|
+
if (state.pointer.isDown) {
|
|
85
|
+
if (!this.pointerDown) {
|
|
86
|
+
this.screenStartPoint = pointerPos;
|
|
87
|
+
this.pointerDown = true;
|
|
88
|
+
if (this.page === 0 && pointerPdfPos.isOnPage) {
|
|
89
|
+
this.page = pointerPdfPos.pdfPoint.page;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (this.screenStartPoint) {
|
|
93
|
+
const rect = getRectFromSelection(state.document, {
|
|
94
|
+
x: this.screenStartPoint.x,
|
|
95
|
+
y: this.screenStartPoint.y,
|
|
96
|
+
}, {
|
|
97
|
+
x: pointerPos.x,
|
|
98
|
+
y: pointerPos.y,
|
|
99
|
+
}, this.page);
|
|
100
|
+
if (rect) {
|
|
101
|
+
const lineWidth = 2 * devicePixelRatio;
|
|
102
|
+
ctx.save();
|
|
103
|
+
ctx.strokeStyle = this.options.viewer.general.textSelectionColor;
|
|
104
|
+
ctx.fillStyle = this.options.viewer.general.textSelectionColor;
|
|
105
|
+
ctx.lineWidth = lineWidth;
|
|
106
|
+
ctx.setLineDash([lineWidth, lineWidth]);
|
|
107
|
+
ctx.strokeRect(rect.x, rect.y, rect.w, rect.h);
|
|
108
|
+
ctx.globalAlpha = 0.33;
|
|
109
|
+
ctx.fillRect(rect.x, rect.y, rect.w, rect.h);
|
|
110
|
+
ctx.restore();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (this.pointerDown && this.screenStartPoint) {
|
|
115
|
+
const rect = getRectFromSelection(state.document, {
|
|
116
|
+
x: this.screenStartPoint.x,
|
|
117
|
+
y: this.screenStartPoint.y,
|
|
118
|
+
}, {
|
|
119
|
+
x: pointerPos.x,
|
|
120
|
+
y: pointerPos.y,
|
|
121
|
+
}, this.page);
|
|
122
|
+
if (rect) {
|
|
123
|
+
this.createRectangularHighlightAnnotation(rect);
|
|
124
|
+
this.pointerDown = false;
|
|
125
|
+
this.screenStartPoint = null;
|
|
126
|
+
this.page = 0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
let drawSelection = state.canvas.canvasInvalidated;
|
|
132
|
+
if (state.pointer.positionChanged) {
|
|
133
|
+
const pointerPos = {
|
|
134
|
+
x: state.pointer.x.devicePixels,
|
|
135
|
+
y: state.pointer.y.devicePixels,
|
|
136
|
+
};
|
|
137
|
+
const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
|
|
138
|
+
let currentTextFragment = null;
|
|
139
|
+
if (pointerPdfPos.isOnPage) {
|
|
140
|
+
currentTextFragment = this.pdfApi.getTextFragmentOnPoint(pointerPos);
|
|
141
|
+
if (currentTextFragment) {
|
|
142
|
+
this.store.viewer.setCursorStyle(CursorStyle.TEXT);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.store.viewer.setCursorStyle(CursorStyle.DEFAULT);
|
|
150
|
+
}
|
|
151
|
+
if (state.pointer.stateChanged) {
|
|
152
|
+
if (state.pointer.isDown) {
|
|
153
|
+
if (pointerPdfPos.isOnPage) {
|
|
154
|
+
if (currentTextFragment) {
|
|
155
|
+
const startPdfPos = pointerPdfPos;
|
|
156
|
+
this.selecting = true;
|
|
157
|
+
this.selection = null;
|
|
158
|
+
this.pdfStartPoint = startPdfPos.pdfPoint;
|
|
159
|
+
drawSelection = true;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
if (this.selecting) {
|
|
165
|
+
const ctx = this.context;
|
|
166
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
167
|
+
this.createHighlightAnnotation();
|
|
168
|
+
this.selecting = false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (this.selecting &&
|
|
173
|
+
this.pdfStartPoint &&
|
|
174
|
+
this.pdfStartPoint !== pointerPdfPos.pdfPoint) {
|
|
175
|
+
const endPoint = this.pdfApi.getClosestPointOnPdfByScreenPoint(pointerPos);
|
|
176
|
+
this.selection = this.pdfApi.getTextSelection(this.pdfStartPoint, endPoint);
|
|
177
|
+
}
|
|
178
|
+
drawSelection = true;
|
|
179
|
+
}
|
|
180
|
+
if (drawSelection && this.selection) {
|
|
181
|
+
const ctx = this.context;
|
|
182
|
+
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
183
|
+
const screenSelection = [];
|
|
184
|
+
for (let i = 0; i < this.selection.quadrilaterals.length; i++) {
|
|
185
|
+
const path = this.pdfApi.transformQuadrilateralToViewport(this.selection.quadrilaterals[i]);
|
|
186
|
+
screenSelection.push(path);
|
|
187
|
+
}
|
|
188
|
+
renderTextSelection(ctx, devicePixelRatio * state.document.zoom, this.options.viewer.general.textSelectionColor, screenSelection);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
setColor(color) {
|
|
194
|
+
this.selectedColor = color;
|
|
195
|
+
this.options.annotation.colors.highlightAnnotationColor = color;
|
|
196
|
+
}
|
|
197
|
+
setTool(tool) {
|
|
198
|
+
this.selectedTool = tool;
|
|
199
|
+
}
|
|
200
|
+
close() {
|
|
201
|
+
this.remove();
|
|
202
|
+
}
|
|
203
|
+
getPdfItemTypeForTool() {
|
|
204
|
+
switch (this.selectedTool) {
|
|
205
|
+
case HighlightTool.HIGHLIGHT:
|
|
206
|
+
return PdfItemType.HIGHLIGHT;
|
|
207
|
+
case HighlightTool.RECTANGULAR_HIGHLIGHT:
|
|
208
|
+
return PdfItemType.HIGHLIGHT;
|
|
209
|
+
case HighlightTool.UNDERLINE:
|
|
210
|
+
return PdfItemType.UNDERLINE;
|
|
211
|
+
case HighlightTool.SQUIGGLY:
|
|
212
|
+
return PdfItemType.SQUIGGLY;
|
|
213
|
+
case HighlightTool.STRIKE_OUT:
|
|
214
|
+
return PdfItemType.STRIKE_OUT;
|
|
215
|
+
default:
|
|
216
|
+
throw new Error('unknown Highlight tool');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
createRectangularHighlightAnnotation(rect) {
|
|
220
|
+
const pdfRect = this.pdfApi.transformScreenRectToPdfRect(rect, this.page);
|
|
221
|
+
const colorObj = new Color(this.selectedColor);
|
|
222
|
+
colorObj.setOpacity(this.options.annotation.highlightOpacity);
|
|
223
|
+
const color = colorObj.toRgba();
|
|
224
|
+
const quadrilaterals = [];
|
|
225
|
+
quadrilaterals.push({
|
|
226
|
+
pageNumber: this.page,
|
|
227
|
+
bottomLeft: { x: pdfRect.pdfX, y: pdfRect.pdfY },
|
|
228
|
+
bottomRight: { x: pdfRect.pdfX + pdfRect.pdfW, y: pdfRect.pdfY },
|
|
229
|
+
topLeft: { x: pdfRect.pdfX, y: pdfRect.pdfY + pdfRect.pdfH },
|
|
230
|
+
topRight: { x: pdfRect.pdfX + pdfRect.pdfW, y: pdfRect.pdfY + pdfRect.pdfH },
|
|
231
|
+
});
|
|
232
|
+
const args = {
|
|
233
|
+
itemType: PdfItemType.HIGHLIGHT,
|
|
234
|
+
page: this.page,
|
|
235
|
+
pdfRect,
|
|
236
|
+
color,
|
|
237
|
+
author: this.options.viewer.general.user,
|
|
238
|
+
quadrilaterals,
|
|
239
|
+
};
|
|
240
|
+
this.pdfApi.createItem(args).then((item) => {
|
|
241
|
+
this.onAnnotationCreated(item);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
createHighlightAnnotation() {
|
|
245
|
+
if (this.pdfApi && this.store) {
|
|
246
|
+
const pdfItemType = this.getPdfItemTypeForTool();
|
|
247
|
+
const selection = this.selection;
|
|
248
|
+
this.selection = null;
|
|
249
|
+
if (selection) {
|
|
250
|
+
const selByPage = [];
|
|
251
|
+
for (let i = 0; i < selection.quadrilaterals.length; i++) {
|
|
252
|
+
const quadrilateral = selection.quadrilaterals[i];
|
|
253
|
+
if (!selByPage[quadrilateral.pageNumber]) {
|
|
254
|
+
selByPage[quadrilateral.pageNumber] = [];
|
|
255
|
+
}
|
|
256
|
+
selByPage[quadrilateral.pageNumber].push(quadrilateral);
|
|
257
|
+
}
|
|
258
|
+
let color = this.selectedColor;
|
|
259
|
+
if (pdfItemType === PdfItemType.HIGHLIGHT) {
|
|
260
|
+
const colorObj = new Color(color);
|
|
261
|
+
colorObj.setOpacity(this.options.annotation.highlightOpacity);
|
|
262
|
+
color = colorObj.toRgba();
|
|
263
|
+
}
|
|
264
|
+
for (let i = 0; i < selByPage.length; i++) {
|
|
265
|
+
if (selByPage[i]) {
|
|
266
|
+
const quadrilaterals = selByPage[i];
|
|
267
|
+
const args = {
|
|
268
|
+
itemType: pdfItemType,
|
|
269
|
+
page: i,
|
|
270
|
+
pdfRect: {
|
|
271
|
+
pdfX: 0,
|
|
272
|
+
pdfY: 0,
|
|
273
|
+
pdfW: 0,
|
|
274
|
+
pdfH: 0,
|
|
275
|
+
page: i,
|
|
276
|
+
},
|
|
277
|
+
color,
|
|
278
|
+
author: this.options.viewer.general.user,
|
|
279
|
+
quadrilaterals,
|
|
280
|
+
};
|
|
281
|
+
this.pdfApi.createItem(args).then((item) => {
|
|
282
|
+
this.onAnnotationCreated(item);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HighlightTool } from './AddHighlightAnnotationLayer';
|
|
2
|
+
export interface AddHighlightAnnotationToolbarProps {
|
|
3
|
+
colors: string[];
|
|
4
|
+
selectedColor: string;
|
|
5
|
+
selectedTool: HighlightTool;
|
|
6
|
+
onToolChanged(tool: HighlightTool): void;
|
|
7
|
+
onColorChanged(color: string): void;
|
|
8
|
+
onClose(): void;
|
|
9
|
+
}
|
|
10
|
+
interface AddHighlightAnnotationToolbarState {
|
|
11
|
+
colors: string[];
|
|
12
|
+
selectedTool: HighlightTool;
|
|
13
|
+
selectedColor: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AddHighlightAnnotationToolbarActions {
|
|
16
|
+
setColor(color: string): AddHighlightAnnotationToolbarState;
|
|
17
|
+
setTool(tool: HighlightTool): AddHighlightAnnotationToolbarState;
|
|
18
|
+
}
|
|
19
|
+
export declare const createAddHighlightAnnotationToolbar: (props: AddHighlightAnnotationToolbarProps, element: HTMLElement) => AddHighlightAnnotationToolbarActions;
|
|
20
|
+
export {};
|