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