@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,134 @@
|
|
|
1
|
+
import { app, h } from '../../lib/hyperapp';
|
|
2
|
+
import { icons } from '../../common/icons';
|
|
3
|
+
import { Icon } from '../../common/Icon';
|
|
4
|
+
import { Loader } from '../../common/Loader';
|
|
5
|
+
import { translationManager } from '../../common/TranslationManager';
|
|
6
|
+
export var PaperFormat;
|
|
7
|
+
(function (PaperFormat) {
|
|
8
|
+
PaperFormat[PaperFormat["A4"] = 0] = "A4";
|
|
9
|
+
PaperFormat[PaperFormat["LETTER"] = 1] = "LETTER";
|
|
10
|
+
})(PaperFormat || (PaperFormat = {}));
|
|
11
|
+
export const createPrintServiceDialog = (props, element) => {
|
|
12
|
+
const state = {
|
|
13
|
+
pages: [],
|
|
14
|
+
selectedFormat: PaperFormat.A4,
|
|
15
|
+
radio_selection: 'all',
|
|
16
|
+
printPending: false,
|
|
17
|
+
includeAnnotations: true,
|
|
18
|
+
};
|
|
19
|
+
const actions = {
|
|
20
|
+
setFormat: (format) => ($state) => {
|
|
21
|
+
let selectedFormat = $state.selectedFormat;
|
|
22
|
+
if (format === 0) {
|
|
23
|
+
selectedFormat = PaperFormat.A4;
|
|
24
|
+
}
|
|
25
|
+
else if (format === 1) {
|
|
26
|
+
selectedFormat = PaperFormat.LETTER;
|
|
27
|
+
}
|
|
28
|
+
return Object.assign(Object.assign({}, $state), { selectedFormat });
|
|
29
|
+
},
|
|
30
|
+
setRadioSelection: (sel) => ($state) => {
|
|
31
|
+
return Object.assign(Object.assign({}, $state), { radio_selection: sel });
|
|
32
|
+
},
|
|
33
|
+
setPrintPending: (printPending) => ($state) => {
|
|
34
|
+
return Object.assign(Object.assign({}, $state), { printPending });
|
|
35
|
+
},
|
|
36
|
+
toggleIncludeAnnotations: () => ($state) => {
|
|
37
|
+
return Object.assign(Object.assign({}, $state), { includeAnnotations: !$state.includeAnnotations });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const App = () => (h(PrintServiceDialog, { print: props.print, cancel: props.cancel, pageCount: props.pageCount, currentPage: props.currentPage, parseRange: props.parseRange, validateRange: props.validateRange }));
|
|
41
|
+
const PrintServiceDialog = ({ print, cancel, parseRange, validateRange }) => ($state, $actions) => (h("div", { class: "pwv-print-body", id: "pwv-print-body" },
|
|
42
|
+
h("div", { class: "pwv-print-title" },
|
|
43
|
+
h(Icon, { className: "pwv-print-icon", icon: icons.print, fill: '#008BD2' }),
|
|
44
|
+
translationManager.getText('print.title')),
|
|
45
|
+
$state.printPending ? (h("div", null,
|
|
46
|
+
h(Loader, null),
|
|
47
|
+
h("div", { class: "pwv-print-bottom pwv-print-bottom-center" },
|
|
48
|
+
h("button", { class: "pwv-print-button-cancel", onclick: () => {
|
|
49
|
+
cancel();
|
|
50
|
+
} }, translationManager.getText('print.cancel'))))) : (h("div", null,
|
|
51
|
+
h("div", { class: "pwv-print-pages" },
|
|
52
|
+
h("div", { class: "pwv-print-option" },
|
|
53
|
+
h("label", null,
|
|
54
|
+
h("input", { type: "radio", id: "all", checked: $state.radio_selection === 'all' ? true : false, onclick: () => {
|
|
55
|
+
$actions.setRadioSelection('all');
|
|
56
|
+
} }),
|
|
57
|
+
h("span", { class: "pwv-print-radio" }),
|
|
58
|
+
translationManager.getText('print.all'))),
|
|
59
|
+
h("div", { class: "pwv-print-option" },
|
|
60
|
+
h("label", null,
|
|
61
|
+
h("input", { type: "radio", id: "current_page", checked: $state.radio_selection === 'current_page' ? true : false, onclick: () => {
|
|
62
|
+
$actions.setRadioSelection('current_page');
|
|
63
|
+
} }),
|
|
64
|
+
h("span", { class: "pwv-print-radio" }),
|
|
65
|
+
translationManager.getText('print.current'))),
|
|
66
|
+
h("div", { class: "pwv-print-option" },
|
|
67
|
+
h("label", null,
|
|
68
|
+
h("input", { type: "radio", id: "range", checked: $state.radio_selection === 'range' ? true : false, onclick: () => {
|
|
69
|
+
$actions.setRadioSelection('range');
|
|
70
|
+
} }),
|
|
71
|
+
h("span", { class: "pwv-print-radio" }),
|
|
72
|
+
translationManager.getText('print.range')),
|
|
73
|
+
h("input", { class: "pwv-print-page-range", id: "pwv-print-input-range", type: "text", placeholder: "e.g. 1,3-5", onkeydown: (e) => {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
}, onkeyup: (e) => {
|
|
76
|
+
if (state.radio_selection !== 'range') {
|
|
77
|
+
$actions.setRadioSelection('range');
|
|
78
|
+
}
|
|
79
|
+
const inputElement = document.getElementById('pwv-print-input-range');
|
|
80
|
+
const errorMessage = document.getElementById('pwv-print-invalid-range-text');
|
|
81
|
+
let bValidInput = false;
|
|
82
|
+
if (validateRange(inputElement.value)) {
|
|
83
|
+
const pages = parseRange(inputElement.value);
|
|
84
|
+
bValidInput = !pages.some((page) => page > props.pageCount || page < 1);
|
|
85
|
+
}
|
|
86
|
+
if (bValidInput) {
|
|
87
|
+
inputElement.classList.remove('pwv-print-invalid-input');
|
|
88
|
+
errorMessage.style.display = 'none';
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
inputElement.classList.add('pwv-print-invalid-input');
|
|
92
|
+
errorMessage.style.display = 'block';
|
|
93
|
+
}
|
|
94
|
+
} })),
|
|
95
|
+
h("div", { class: "pwv-print-invalid-range-text-container" },
|
|
96
|
+
h("div", { class: "pwv-print-invalid-range-text", id: "pwv-print-invalid-range-text" }, translationManager.getText('print.invalid'))),
|
|
97
|
+
h("div", { class: "pwv-print-option" },
|
|
98
|
+
h("div", { class: "pwv-checkbox-btn pwv-print-include-annotations", onclick: (e) => {
|
|
99
|
+
$actions.toggleIncludeAnnotations();
|
|
100
|
+
} },
|
|
101
|
+
$state.includeAnnotations ? (h(Icon, { icon: icons.checkboxChecked })) : (h(Icon, { icon: icons.checkbox })),
|
|
102
|
+
translationManager.getText('print.includeAnnotations')))),
|
|
103
|
+
h("div", { class: "pwv-print-bottom" },
|
|
104
|
+
h("button", { class: "pwv-print-button-cancel", onclick: () => {
|
|
105
|
+
cancel();
|
|
106
|
+
} }, translationManager.getText('print.cancel')),
|
|
107
|
+
h("button", { class: "pwv-print-button-print", onclick: () => {
|
|
108
|
+
if ($state.radio_selection === 'all') {
|
|
109
|
+
const pages = Array.from({ length: props.pageCount }, (x, i) => i + 1);
|
|
110
|
+
print({
|
|
111
|
+
pages,
|
|
112
|
+
format: $state.selectedFormat,
|
|
113
|
+
includeAnnotations: $state.includeAnnotations,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if ($state.radio_selection === 'current_page') {
|
|
117
|
+
print({
|
|
118
|
+
pages: [props.currentPage],
|
|
119
|
+
format: $state.selectedFormat,
|
|
120
|
+
includeAnnotations: $state.includeAnnotations,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if ($state.radio_selection === 'range') {
|
|
124
|
+
const input = document.getElementById('pwv-print-input-range').value;
|
|
125
|
+
const pages = parseRange(input);
|
|
126
|
+
print({
|
|
127
|
+
pages,
|
|
128
|
+
format: $state.selectedFormat,
|
|
129
|
+
includeAnnotations: $state.includeAnnotations,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
} }, translationManager.getText('print.print')))))));
|
|
133
|
+
return app(state, actions, App, element);
|
|
134
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ViewerCanvasState } from 'pdf-viewer-canvas/state/store';
|
|
2
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
3
|
+
import { PaperFormat } from './PrintServiceDialog';
|
|
4
|
+
export declare class PrintServiceLayer extends CanvasLayer {
|
|
5
|
+
private printDialog;
|
|
6
|
+
private printElement;
|
|
7
|
+
private printIFrame;
|
|
8
|
+
private pageStyle;
|
|
9
|
+
private printPending;
|
|
10
|
+
onCreate(): void;
|
|
11
|
+
startPrint({ pages, format, includeAnnotations, }: {
|
|
12
|
+
pages: number[];
|
|
13
|
+
format?: PaperFormat;
|
|
14
|
+
includeAnnotations: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
cancelPrint(): void;
|
|
17
|
+
private stopTouchEventPropagation;
|
|
18
|
+
private validateRange;
|
|
19
|
+
private parseRange;
|
|
20
|
+
close(): void;
|
|
21
|
+
onRemove(): void;
|
|
22
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
23
|
+
onSave(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
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 { createPrintServiceDialog } from './PrintServiceDialog';
|
|
12
|
+
const moduleLayerName = 'PrintServiceLayer';
|
|
13
|
+
export class PrintServiceLayer extends CanvasLayer {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.printDialog = null;
|
|
17
|
+
this.printElement = null;
|
|
18
|
+
this.printIFrame = null;
|
|
19
|
+
this.pageStyle = null;
|
|
20
|
+
this.printPending = false;
|
|
21
|
+
}
|
|
22
|
+
onCreate() {
|
|
23
|
+
this.startPrint = this.startPrint.bind(this);
|
|
24
|
+
this.cancelPrint = this.cancelPrint.bind(this);
|
|
25
|
+
this.validateRange = this.validateRange.bind(this);
|
|
26
|
+
this.parseRange = this.parseRange.bind(this);
|
|
27
|
+
this.stopTouchEventPropagation = this.stopTouchEventPropagation.bind(this);
|
|
28
|
+
this.printElement = this.createHtmlLayer();
|
|
29
|
+
this.printElement.className = 'pwv-print-dialog';
|
|
30
|
+
this.printDialog = createPrintServiceDialog({
|
|
31
|
+
pageCount: this.pdfApi.getPageCount(),
|
|
32
|
+
currentPage: this.store.getState().document.firstVisiblePage,
|
|
33
|
+
print: this.startPrint,
|
|
34
|
+
cancel: this.cancelPrint,
|
|
35
|
+
validateRange: this.validateRange,
|
|
36
|
+
parseRange: this.parseRange,
|
|
37
|
+
}, this.printElement);
|
|
38
|
+
this.store.viewer.beginModule(moduleLayerName);
|
|
39
|
+
this.printElement.addEventListener('touchstart', this.stopTouchEventPropagation);
|
|
40
|
+
this.printElement.addEventListener('touchend', this.stopTouchEventPropagation);
|
|
41
|
+
}
|
|
42
|
+
startPrint({ pages, format, includeAnnotations, }) {
|
|
43
|
+
var _a;
|
|
44
|
+
this.printPending = true;
|
|
45
|
+
if (this.printDialog) {
|
|
46
|
+
this.printDialog.setPrintPending(true);
|
|
47
|
+
}
|
|
48
|
+
if (!this.printIFrame) {
|
|
49
|
+
this.printIFrame = document.createElement('iframe');
|
|
50
|
+
this.printIFrame.style.display = 'none';
|
|
51
|
+
document.body.appendChild(this.printIFrame);
|
|
52
|
+
const doc = this.printIFrame.contentDocument;
|
|
53
|
+
doc.open();
|
|
54
|
+
doc.close();
|
|
55
|
+
if (doc.head) {
|
|
56
|
+
const styleElm = doc.createElement('style');
|
|
57
|
+
styleElm.textContent = `
|
|
58
|
+
@media print {
|
|
59
|
+
@page {size:A4;margin:0;padding:0}
|
|
60
|
+
body {margin:0;padding:0;background-color:white;height:100%;}
|
|
61
|
+
.page {
|
|
62
|
+
width: 210mm;
|
|
63
|
+
height: 297mm;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
page-break-after: always;
|
|
66
|
+
break-after: always;
|
|
67
|
+
-webkit-region-break-after: always;
|
|
68
|
+
-webkit-column-break-after: always;
|
|
69
|
+
-webkit-page-break-after: always;
|
|
70
|
+
}
|
|
71
|
+
.page:last-child {
|
|
72
|
+
page-break-after: auto;
|
|
73
|
+
break-after: auto;
|
|
74
|
+
-webkit-page-break-after: auto;
|
|
75
|
+
}
|
|
76
|
+
.page img {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: auto;
|
|
79
|
+
display: block;
|
|
80
|
+
page-break-inside: avoid;
|
|
81
|
+
break-inside: avoid;
|
|
82
|
+
-webkit-region-break-inside: avoid;
|
|
83
|
+
-webkit-column-break-inside: avoid;
|
|
84
|
+
-webkit-page-break-inside: avoid;
|
|
85
|
+
}
|
|
86
|
+
body.is-safari .page {
|
|
87
|
+
width: 100% !important;
|
|
88
|
+
height: 100% !important;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
doc.head.append(styleElm);
|
|
93
|
+
}
|
|
94
|
+
// Safari detection
|
|
95
|
+
if (/Safari\//.test(navigator.userAgent) && !/Chrome\//.test(navigator.userAgent)) {
|
|
96
|
+
doc.body.classList.add('is-safari');
|
|
97
|
+
}
|
|
98
|
+
// Close print modal when OS print dialog is closed
|
|
99
|
+
(_a = this.printIFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.addEventListener('afterprint', () => {
|
|
100
|
+
this.close();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const printDocument = this.printIFrame.contentDocument;
|
|
104
|
+
printDocument.body.innerHTML = '';
|
|
105
|
+
const pageList = printDocument.createElement('div');
|
|
106
|
+
printDocument.body.append(pageList);
|
|
107
|
+
const pdfApi = this.pdfApi;
|
|
108
|
+
const dpi = 150;
|
|
109
|
+
// paper sizes
|
|
110
|
+
const paperSizes = {
|
|
111
|
+
a4: {
|
|
112
|
+
width: 595,
|
|
113
|
+
height: 842,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
const printerPaperSize = paperSizes.a4;
|
|
117
|
+
// papersize in pixels for a4
|
|
118
|
+
const paperSize = {
|
|
119
|
+
width: (printerPaperSize.width / 72) * dpi,
|
|
120
|
+
height: (printerPaperSize.height / 72) * dpi,
|
|
121
|
+
};
|
|
122
|
+
// canvas for image creation
|
|
123
|
+
const canvas = printDocument.createElement('canvas');
|
|
124
|
+
canvas.width = paperSize.width;
|
|
125
|
+
canvas.height = paperSize.height;
|
|
126
|
+
const ctx = canvas.getContext('2d');
|
|
127
|
+
const renderNextPage = () => __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
if (!this.printPending) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const page = pages.shift();
|
|
132
|
+
if (page) {
|
|
133
|
+
const pageSize = yield pdfApi.getPagePdfSize(page);
|
|
134
|
+
let pageWidth = (pageSize.width / 72) * dpi;
|
|
135
|
+
let pageHeight = (pageSize.height / 72) * dpi;
|
|
136
|
+
const isLandscape = pageWidth > pageHeight;
|
|
137
|
+
//shrink page if the page is larger then lager then paper size
|
|
138
|
+
let scale = 1;
|
|
139
|
+
if (isLandscape) {
|
|
140
|
+
scale = Math.min(paperSize.height / pageWidth, paperSize.width / pageHeight);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
scale = Math.min(paperSize.width / pageWidth, paperSize.height / pageHeight);
|
|
144
|
+
}
|
|
145
|
+
if (scale < 1) {
|
|
146
|
+
pageWidth = pageWidth * scale;
|
|
147
|
+
pageHeight = pageHeight * scale;
|
|
148
|
+
}
|
|
149
|
+
let annotationFilter = includeAnnotations ? undefined : () => false;
|
|
150
|
+
const img = yield pdfApi.renderPage(page, pageWidth, pageHeight, annotationFilter);
|
|
151
|
+
if (ctx) {
|
|
152
|
+
ctx.clearRect(0, 0, paperSize.width, paperSize.height);
|
|
153
|
+
ctx.save();
|
|
154
|
+
if (isLandscape) {
|
|
155
|
+
// putImageData is not affected by the transformation matrix
|
|
156
|
+
// need to draw draw to a tmp camvas
|
|
157
|
+
const tmpCanvas = printDocument.createElement('canvas');
|
|
158
|
+
tmpCanvas.width = img.imageData.width;
|
|
159
|
+
tmpCanvas.height = img.imageData.height;
|
|
160
|
+
const tmpCtx = tmpCanvas.getContext('2d');
|
|
161
|
+
if (tmpCtx) {
|
|
162
|
+
tmpCtx.putImageData(img.imageData, 0, 0);
|
|
163
|
+
}
|
|
164
|
+
const imgPosX = (paperSize.height - img.imageData.width) / 2;
|
|
165
|
+
const imgPosY = (paperSize.width - img.imageData.height) / 2;
|
|
166
|
+
ctx.translate(canvas.width, 0);
|
|
167
|
+
ctx.rotate((90 * Math.PI) / 180);
|
|
168
|
+
ctx.drawImage(tmpCanvas, imgPosX, imgPosY);
|
|
169
|
+
// draw page rectangle for debugging
|
|
170
|
+
// ctx.strokeStyle = 'blue'
|
|
171
|
+
// ctx.lineWidth = 4
|
|
172
|
+
// ctx.strokeRect(
|
|
173
|
+
// imgPosX + 2,
|
|
174
|
+
// imgPosY + 2,
|
|
175
|
+
// img.imageData.width - 4,
|
|
176
|
+
// img.imageData.height - 4
|
|
177
|
+
// )
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const imgPosX = (paperSize.width - pageWidth) / 2;
|
|
181
|
+
const imgPosY = (paperSize.height - pageHeight) / 2;
|
|
182
|
+
ctx.putImageData(img.imageData, imgPosX, imgPosY);
|
|
183
|
+
// draw page rectangle for debugging
|
|
184
|
+
// ctx.strokeStyle = 'red'
|
|
185
|
+
// ctx.lineWidth = 4
|
|
186
|
+
// ctx.strokeRect(
|
|
187
|
+
// imgPosX + 2,
|
|
188
|
+
// imgPosY + 2,
|
|
189
|
+
// pageWidth - 4,
|
|
190
|
+
// pageHeight - 4
|
|
191
|
+
// )
|
|
192
|
+
}
|
|
193
|
+
ctx.restore();
|
|
194
|
+
// create and append html elements to page list
|
|
195
|
+
const pageElm = printDocument.createElement('div');
|
|
196
|
+
pageElm.classList.add('page');
|
|
197
|
+
pageList.append(pageElm);
|
|
198
|
+
const imgSrc = canvas.toDataURL('image/png');
|
|
199
|
+
const imgElm = printDocument.createElement('img');
|
|
200
|
+
imgElm.src = imgSrc;
|
|
201
|
+
pageElm.append(imgElm);
|
|
202
|
+
}
|
|
203
|
+
renderNextPage();
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
window.setTimeout(() => {
|
|
207
|
+
this.printPending = false;
|
|
208
|
+
if (this.printDialog) {
|
|
209
|
+
this.printDialog.setPrintPending(false);
|
|
210
|
+
}
|
|
211
|
+
if (this.printIFrame && this.printIFrame.contentWindow) {
|
|
212
|
+
this.printIFrame.contentWindow.print();
|
|
213
|
+
}
|
|
214
|
+
}, 100);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
renderNextPage();
|
|
218
|
+
}
|
|
219
|
+
cancelPrint() {
|
|
220
|
+
this.printPending = false;
|
|
221
|
+
this.remove();
|
|
222
|
+
}
|
|
223
|
+
stopTouchEventPropagation(e) {
|
|
224
|
+
e.stopImmediatePropagation();
|
|
225
|
+
}
|
|
226
|
+
// Validate the provided page range
|
|
227
|
+
validateRange(range) {
|
|
228
|
+
// Only numbers, commas and dashes are allowed
|
|
229
|
+
let regex = range.match(/^[\d\,\-]*$/g);
|
|
230
|
+
if (!regex || (regex && regex.length === 0)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
// Only single dashes and commas are allowed
|
|
234
|
+
regex = range.match(/-{2,}|,{2,}/g);
|
|
235
|
+
if (regex && regex.length > 0) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
// Transform a range string into a list of pages
|
|
241
|
+
// The range string should be validated first
|
|
242
|
+
parseRange(range) {
|
|
243
|
+
let pages = [];
|
|
244
|
+
if (!this.validateRange(range)) {
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
const splitInput = range.split(',');
|
|
248
|
+
splitInput.forEach((input) => {
|
|
249
|
+
const nDashes = (input.match(/-/g) || []).length;
|
|
250
|
+
if (nDashes === 0) {
|
|
251
|
+
// No dash, parse string as int and push
|
|
252
|
+
// number to the list
|
|
253
|
+
pages.push(parseInt(input, 10));
|
|
254
|
+
}
|
|
255
|
+
if (nDashes === 1) {
|
|
256
|
+
const numbers = input.split('-');
|
|
257
|
+
let firstPage = parseInt(numbers[0], 10);
|
|
258
|
+
let lastPage = parseInt(numbers[1], 10);
|
|
259
|
+
// this.printDialog.
|
|
260
|
+
if (lastPage < firstPage) {
|
|
261
|
+
const temp = firstPage;
|
|
262
|
+
firstPage = lastPage;
|
|
263
|
+
lastPage = temp;
|
|
264
|
+
}
|
|
265
|
+
const pageRange = Array.from({ length: lastPage - firstPage + 1 }, (v, k) => k + firstPage);
|
|
266
|
+
pages = pages.concat(pageRange);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
return pages;
|
|
270
|
+
}
|
|
271
|
+
close() {
|
|
272
|
+
this.remove();
|
|
273
|
+
}
|
|
274
|
+
onRemove() {
|
|
275
|
+
var _a, _b;
|
|
276
|
+
(_a = this.printElement) === null || _a === void 0 ? void 0 : _a.removeEventListener('touchstart', this.stopTouchEventPropagation);
|
|
277
|
+
(_b = this.printElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('touchend', this.stopTouchEventPropagation);
|
|
278
|
+
this.removeHtmlElements();
|
|
279
|
+
this.printPending = false;
|
|
280
|
+
this.printElement = null;
|
|
281
|
+
if (this.pageStyle) {
|
|
282
|
+
this.pageStyle.remove();
|
|
283
|
+
}
|
|
284
|
+
if (this.printIFrame) {
|
|
285
|
+
document.body.removeChild(this.printIFrame);
|
|
286
|
+
}
|
|
287
|
+
this.store.viewer.endModule(moduleLayerName);
|
|
288
|
+
}
|
|
289
|
+
render(timestamp, state) {
|
|
290
|
+
if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
|
|
291
|
+
this.remove();
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (this.printElement && state.pointer.action === 'click') {
|
|
295
|
+
const insideHorizontal = state.pointer.x.cssPixels > this.printElement.offsetLeft &&
|
|
296
|
+
state.pointer.x.cssPixels < this.printElement.offsetLeft + this.printElement.offsetWidth;
|
|
297
|
+
const insideVertical = state.pointer.y.cssPixels > this.printElement.offsetTop &&
|
|
298
|
+
state.pointer.y.cssPixels < this.printElement.offsetTop + this.printElement.offsetHeight;
|
|
299
|
+
if (!insideHorizontal || !insideVertical) {
|
|
300
|
+
this.remove();
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
onSave() {
|
|
306
|
+
return new Promise((resolve, rejct) => {
|
|
307
|
+
return;
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
export declare class PrintServiceModule extends CanvasModule {
|
|
3
|
+
annotationbarElement: HTMLElement | null;
|
|
4
|
+
toolbarElement: HTMLElement | null;
|
|
5
|
+
static moduleInfo: {
|
|
6
|
+
name: string;
|
|
7
|
+
moduleType: CanvasModuleType;
|
|
8
|
+
requiredFeatures: {
|
|
9
|
+
annotate: boolean;
|
|
10
|
+
fillFormFields: boolean;
|
|
11
|
+
};
|
|
12
|
+
translationKey: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
};
|
|
15
|
+
constructor();
|
|
16
|
+
onRegister(): {};
|
|
17
|
+
activate(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CanvasModule, CanvasModuleType } from '../CanvasModule';
|
|
2
|
+
import { PrintServiceLayer } from './PrintServiceLayer';
|
|
3
|
+
export class PrintServiceModule extends CanvasModule {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.annotationbarElement = null;
|
|
7
|
+
this.toolbarElement = null;
|
|
8
|
+
this.name = PrintServiceModule.moduleInfo.name;
|
|
9
|
+
this.activate = this.activate.bind(this);
|
|
10
|
+
}
|
|
11
|
+
onRegister() {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
activate() {
|
|
15
|
+
/* tslint:disable-next-line:no-string-literal */
|
|
16
|
+
if (!this.canvasLayers['add']) {
|
|
17
|
+
this.createCanvasLayer('add', PrintServiceLayer);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
PrintServiceModule.moduleInfo = {
|
|
22
|
+
name: 'PrintServiceModule',
|
|
23
|
+
moduleType: CanvasModuleType.Layer,
|
|
24
|
+
requiredFeatures: {
|
|
25
|
+
annotate: false,
|
|
26
|
+
fillFormFields: false,
|
|
27
|
+
},
|
|
28
|
+
translationKey: 'a',
|
|
29
|
+
icon: 'a',
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CanvasLayer } from '../CanvasLayer';
|
|
2
|
+
import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
|
|
3
|
+
import { PdfItemType } from '../../pdf-viewer-api';
|
|
4
|
+
export declare class AddShapeAnnotationLayer extends CanvasLayer {
|
|
5
|
+
private context;
|
|
6
|
+
private toolbar;
|
|
7
|
+
private page;
|
|
8
|
+
private pointerDown;
|
|
9
|
+
private startPoint;
|
|
10
|
+
private itemType;
|
|
11
|
+
private strokeColors;
|
|
12
|
+
private fillColors;
|
|
13
|
+
onCreate(itemType: PdfItemType): void;
|
|
14
|
+
cancel(): void;
|
|
15
|
+
onSave(): Promise<void>;
|
|
16
|
+
onRemove(): void;
|
|
17
|
+
render(timestamp: number, state: ViewerCanvasState): void;
|
|
18
|
+
private setStrokeColor;
|
|
19
|
+
private setShape;
|
|
20
|
+
private setStrokeWidth;
|
|
21
|
+
private setStrokeStyle;
|
|
22
|
+
private setFillColor;
|
|
23
|
+
private createRectangleAnnotation;
|
|
24
|
+
}
|