Pārlūkot izejas kodu

add: 添加注释类

wzl 2 mēneši atpakaļ
vecāks
revīzija
57c9fb7863

+ 45 - 0
packages/webviewer-core/src/AnnotationHistoryManager.js

@@ -0,0 +1,45 @@
+import EventHandler from './EventHandler';
+
+/**
+ * The manager of the Annotation history state for undoing and redoing annotation changes
+ * @memberof Core
+ * @extends Core.EventHandler
+ */
+class AnnotationHistoryManager extends EventHandler {
+  /***
+   * Returns whether there is a change available to redo
+   * @returns {boolean} Whether there is a change that can be redone or not
+   */
+  canRedo() {}
+
+  /***
+   * Returns whether there is a change available to undo
+   * @returns {boolean} Whether there is a change that can be undone or not
+   */
+  canUndo() {}
+
+  /***
+   * Clears the undo/redo history so that no older changes can be undone.
+   */
+  clear() {}
+
+  /***
+   * Reapplies the most recent annotation change that was undone
+   * @returns {Promise.<void>} Returns a promise that resolves when the operation is complete
+   */
+  redo() {}
+
+  /***
+   * Undoes the most recent annotation change
+   * @returns {Promise.<void>} Returns a promise that resolves when the operation is complete
+   */
+  undo() {}
+
+  /**
+   * Triggered when the annotation history stack changes. This could be used to check the canUndo or canRedo functions if their value has changed.
+   * @event Core.AnnotationHistoryManager#historyChanged
+   */
+  historyChanged() {}
+}
+
+export default AnnotationHistoryManager;

+ 3 - 1
packages/webviewer-core/src/Annotations/EllipseAnnotation.js

@@ -8,7 +8,6 @@ class EllipseAnnotation extends MarkupAnnotation {
   /**
    * Represents an ellipse annotation.
    * @extends Core.Annotations.MarkupAnnotation
-   * 
    * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
    */
   constructor(initializer) {
@@ -16,5 +15,8 @@ class EllipseAnnotation extends MarkupAnnotation {
     
     /** Gets or sets the border style of an annotation. e.g Solid, Cloudy */
     this.Style = 'Solid';
+
+    /** Gets or sets the annotation's scale from its measure dictionary. */
+    this.Scale = 1;
   }
 }

+ 104 - 0
packages/webviewer-core/src/Annotations/FreeHandAnnotation.js

@@ -0,0 +1,104 @@
+import IPathAnnotation from './IPathAnnotation';
+
+/**
+ * @memberof Core.Annotations
+ */
+class FreeHandAnnotation extends IPathAnnotation {
+
+  /**
+   * Represents a FreeHand annotation.
+   * @extends Core.Annotations.IPathAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+    
+    /**
+     * The topmost point of the annotation.<br/>
+     * This property cannot be initialized through the initializer.
+     */
+    this.TopMost = null;
+    
+    /**
+     * The leftmost point of the annotation.<br/>
+     * This property cannot be initialized through the initializer.
+     */
+    this.LeftMost = null;
+    
+    /**
+     * The rightmost point of the annotation.<br/>
+     * This property cannot be initialized through the initializer.
+     */
+    this.RightMost = null;
+
+    /**
+     * The bottommost point of the annotation.<br/>
+     * This property cannot be initialized through the initializer.
+     */
+    this.BottomMost = null;
+
+    /** Gets or sets the intent of the freehand. */
+    this.Intent = initializer?.Intent || null;
+
+    /**
+     * Whether to simplify the path points or not.
+     * @default false
+     */
+    this.shouldSimplifyPath = false;
+  }
+
+  /**
+   * Adds a point to the specified path. This method will create a new path if the specified path index is equal to the total number of existings paths, and set the x and y value as its first point.
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   * @param {number} [pathIndex] - The index of the path, defaults to 0
+   */
+  addPathPoint(x, y, pathIndex) {}
+
+  /** empty the paths in the path array. */
+  emptyPaths() {}
+
+  /**
+   * Gets the specified path in the path array.
+   * @param {number} [pathIndex] - The index of the path, defaults to 0
+   * @return {Array.<Core.Math.Point>} The array of path points
+   */
+  getPath(pathIndex) {}
+
+  /**
+   * Gets the specified point in the path at the specified index.
+   * @param {number} index - The index of the point in the specified path
+   * @param {number} [pathIndex] - The index of the path, defaults to 0
+   * @return {Core.Math.Point} The path point as an object with x and y properties
+   */
+  getPathPoint(index, pathIndex) {}
+
+  /**
+   * Gets the array of paths for this annotation.
+   * @return {Array} an array of paths, where a path is an array of Annotation.Points
+   */
+  getPaths() {}
+
+  /**
+   * Removes the last point from the specified path.
+   * @param {number} pathIndex - The index of the path, defaults to 0
+   * @return {Core.Math.Point} The point that was removed from the path.
+   */
+  popPath(pathIndex) {}
+
+  /**
+   * Sets a path in the path array.
+   * @param {Array.<Core.Math.Point>} path - An array of Annotation.Point objects.
+   * @param {number} pathIndex - The index of the path, defaults to 0
+   */
+  setPath(path, pathIndex) {}
+
+  /**
+   * Sets a point at the specified path. This method will create a new path if the specified path index is equal to the total number of existings paths, and set the x and y value as its first point.
+   * @param {number} index - The index in the path array to set
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   * @param {number} [pathIndex] - The index of the path, defaults to 0
+   */
+  setPathPoint(index, x, y, pathIndex) {}
+}

+ 11 - 0
packages/webviewer-core/src/Annotations/FreeTextSelectionModel.js

@@ -0,0 +1,11 @@
+import BoxSelectionModel from './BoxSelectionModel';
+
+/**
+ * A selection model based on the annotation's bounding box. This is used for free text annotations.
+ * @memberof Core.Annotations
+ */
+class FreeTextSelectionModel extends BoxSelectionModel {
+  constructor(annotation, canModify, isSelected) {
+    super(annotation, canModify, isSelected);
+  }
+}

+ 60 - 0
packages/webviewer-core/src/Annotations/IPathAnnotation.js

@@ -0,0 +1,60 @@
+import MarkupAnnotation from './MarkupAnnotation';
+
+/**
+ * @memberof Core.Annotations
+ */
+class IPathAnnotation extends MarkupAnnotation {
+
+  /**
+   * An abstract annotation class for aiding the creation of path-based annotations. Classes extending IPathAnnotation or implements the interface can be used by the PathTools. Note: this class makes no assumptions on serialization
+   * @extends Core.Annotations.MarkupAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+  }
+
+  /**
+   * Adds a point to the path
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   */
+  addPathPoint(x, y) {}
+
+  /** Recalculate the width and height of the annotation */
+  adjustRect() {}
+
+  /**
+   * Gets the path array
+   * @return {Array.<Core.Math.Point>} The array of path points
+   */
+  getPath() {}
+
+  /**
+   * Gets the point in the path at the specified index
+   * @param {number} index - The index in the path array
+   * @return {object} The path point as an object with x and y properties
+   */
+  getPathPoint(index) {}
+
+  /**
+   * Removes the last point from the path
+   * @return {object} The path point as an object with x and y properties
+   */
+  popPath() {}
+
+  /**
+   * Rotate the annotation by angle and origin point to rotate around.
+   * @param {number} angle - The angle in radians
+   * @param {Core.Math.Point} rotationPoint - The rotation point to do the rotation around. The default is the center point of the annotation
+   */
+  rotate(angle, rotationPoint) {}
+
+  /**
+   * Sets the path point at a specific index
+   * @param {number} index - The index in the path array to set
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   */
+  setPathPoint(index, x, y) {}
+}

+ 141 - 0
packages/webviewer-core/src/Annotations/LineAnnotation.js

@@ -0,0 +1,141 @@
+import MarkupAnnotation from './MarkupAnnotation';
+
+/**
+ * @memberof Core.Annotations
+ */
+class LineAnnotation extends MarkupAnnotation {
+
+  /**
+   * @extends Core.Annotations.MarkupAnnotation
+   * @property {string} START - Indicates the caption is snapped to start point of measurement annotation.
+   * @property {string} CENTER - Indicates the caption is snapped to center point of measurement annotation.
+   * @property {string} END - Indicates the caption is snapped to end point of measurement annotation.
+   */
+  static CaptionSnapPositions = {
+    START: 'START',
+    CENTER: 'CENTER',
+    END: 'END'
+  }
+  
+  /**
+   * Represents a line annotation.
+   * @extends Core.Annotations.MarkupAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+
+    /** Gets or sets the start point of the line. */
+    this.Start = initializer?.Start;
+
+    /** Gets or sets the end point of the line. */
+    this.End = initializer?.End;
+
+    /** Gets or sets the annotation's scale from its measure dictionary. */
+    this.Scale = initializer?.Scale || 1;
+
+    /** Gets or sets the border style of an annotation. e.g Solid, Cloudy */
+    this.Style = initializer?.Style || 'solid';
+  }
+
+  /**
+   * Returns the angle in radians from the X axis from start point to end point
+   * @return {number} The angle in radians
+   */
+  getAngle() {}
+
+  /**
+   * Get the current caption snap position.
+   * @see [CaptionSnapPositions]{@link Core.Annotations.LineAnnotation#CaptionSnapPositions}
+   * @return {Core.Annotations.LineAnnotation.CaptionSnapPositions} Returns the current caption snap position.
+   */
+  getCaptionSnapPosition() {}
+
+  /**
+   * Gets the ending point of the line
+   * @return {Core.Math.Point} The end point
+   */
+  getEndPoint() {}
+
+  /**
+   * Gets the end style of the line
+   * @return {Core.Annotations.LineEndType} The end style
+   */
+  getEndStyle() {}
+
+  /**
+   * Returns the leader point located at the given caption snap position, in viewer coordinates.
+   * @param {Core.Annotations.LineAnnotation.CaptionSnapPositions} [captionSnapPosition] - Indicates which side of measurement line to calculate leader point. Default value is whatever is returned from Core.Annotations.LineAnnotation#getCaptionSnapPosition.
+   * @return {Core.Math.Point} Position of leader control handle, in viewer coordinates.
+   */
+  getLeaderLineControlHandlePoint(captionSnapPosition) {}
+
+  /**
+   * Returns the leader points of this line
+   * @return {Core.Annotations.LineAnnotation.LeaderPoints} An object containing the two leader points
+   */
+  getLeaderPoints() {}
+
+  /**
+   * Returns the length of the line in points
+   * @return {number} The length in points
+   */
+  getLineLength() {}
+
+  /**
+   * Gets the starting point of the line
+   * @rerturn {Core.Math.Point} The start point
+   */
+  getStartPoint() {}
+
+  /**
+   * Gets the start style of the line
+   * @return {Core.Annotations.LineEndType} The start style
+   */
+  getStartStyle() {}
+
+  /**
+   * Snaps the caption of a measurement line to given position.
+   * @param {Core.Annotations.LineAnnotation.CaptionSnapPositions} position - Use one of the positions provided by CaptionSnapPositions
+   */
+  setCaptionSnapPosition(position) {}
+
+  /**
+   * Sets the ending point of the line
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   */
+  setEndPoint(x, y) {}
+
+  /**
+   * Sets the ending style of the line
+   * @param {Core.Annotations.LineEndType} endingStyle - The ending style
+   */
+  setEndStyle(endingStyle) {}
+
+  /**
+   * Sets the length of a line
+   * @param {number} length - The length in points
+   */
+  setLineLength(length) {}
+
+  /**
+   * Sets the starting point of the line
+   * @param {number} x - The x coordinate of the point
+   * @param {number} y - The y coordinate of the point
+   */
+  setStartPoint(x, y) {}
+
+  /**
+   * Sets the start style of the line
+   * @param {Core.Annotations.LineEndType} startStyle - The starting style
+   */
+  setStartStyle(startStyle) {}
+}
+
+/**
+ * the point in viewer coordinates
+ * @typedef {Object} LeaderPoints
+ * @property {Core.Math.Point} Start - the start point
+ * @property {Core.Math.Point} End - the end point
+ */

+ 30 - 0
packages/webviewer-core/src/Annotations/Link.js

@@ -0,0 +1,30 @@
+import HTMLAnnotation from './HTMLAnnotation.js'
+
+/**
+ * @memberof Core.Annotations
+ */
+class Link extends HTMLAnnotation {
+
+  /**
+   * Represents a PDF Link annotation with associated actions.
+   * @extends Core.Annotations.HTMLAnnotation
+   * @param {object} options - A map of properties to set on the new Link
+   * @property {string} URI - The URI to launch when the link is clicked
+   */
+  constructor(options) {
+    super(options);
+    this.URI = options?.URI;
+
+    /** Gets or sets the stroke style of the link annotation. */
+    this.StrokeStyle = options?.StrokeStyle;
+
+    /** Gets or sets the stroke thickness of the link annotation. */
+    this.StrokeThickness = options?.StrokeThickness;
+  }
+
+  /**
+   * Returns whether the link is added by WebViewer automatically.
+   * @return {boolean} Whether the link is added by WebViewer automatically.
+   */
+  isAutomaticLink() {}
+}

+ 19 - 0
packages/webviewer-core/src/Annotations/ListWidgetAnnotation.js

@@ -0,0 +1,19 @@
+import WidgetAnnotation from './WidgetAnnotation.js'
+
+/**
+ * Represents a List Widget annotation (a list).
+ * @memberof Core.Annotations
+ */
+class ListWidgetAnnotation extends WidgetAnnotation {
+
+  /**
+   * Creates a new instance of ListWidgetAnnotation.
+   * @extends Core.Annotations.WidgetAnnotation
+   * @param {Core.Annotations.Forms.Field} field - The field to associate with the widget
+   * @param {object} [options] - A map of properties to set on the widget
+   */
+  constructor(field, options) {
+    super(options);
+    this.field = field;
+  }
+}

+ 41 - 0
packages/webviewer-core/src/Annotations/MarkupAnnotation.js

@@ -0,0 +1,41 @@
+import Annotation from './Annotation.js';
+
+/**
+ * Represents an extendable Markup annotation. These annotations may optionally include a fill color, stroke color, and stroke thickness.
+ * @memberof Core.Annotations
+ */
+class MarkupAnnotation extends Annotation {
+
+  /**
+   * Creates a new instance of MarkupAnnotation.
+   * @extends Core.Annotations.Annotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+
+    /** Gets or sets the date the annotation was created. */
+    this.DateCreated = initializer?.DateCreated || new Date();
+
+    /** Gets or sets the color of the annotation's interior. */
+    this.FillColor = initializer?.FillColor;
+
+    /** Gets or sets whether the annotation is hoverable or not. If it is hoverable then the IsHovering property will be true on the annotation when it is currently being hovered. */
+    this.IsHoverable = initializer?.IsHoverable || false;
+
+    /** If the annotation is hoverable then this property gets whether the annotation is currently being hovered or not (if the mouse is over top of the annotation). If it is not hoverable then this will always return false. */
+    this.IsHovering = initializer?.IsHovering || false;
+
+    /** Gets or sets the opacity of the annotation. */
+    this.Opacity = initializer?.Opacity || 1;
+
+    /** Gets or sets the color of the annotation's stroke. */
+    this.StrokeColor = initializer?.StrokeColor;
+
+    /** Gets or sets the width of the annotation's stroke outline. */
+    this.StrokeThickness = initializer?.StrokeThick;
+
+    /** Gets or sets the viewer state (zoom, rotation, etc) that is associated with the annotation. This state can then be restored in the viewer at a later time. */
+    this.ViewState = initializer?.ViewState;
+  }
+}

+ 17 - 0
packages/webviewer-core/src/Annotations/RadioButtonWidgetAnnotation.js

@@ -0,0 +1,17 @@
+import ButtonWidgetAnnotation from './ButtonWidgetAnnotation.js'
+
+/**
+ * @memberof Core.Annotations
+ */
+class RadioButtonWidgetAnnotation extends ButtonWidgetAnnotation {
+
+  /**
+   * A Radio button widget.
+   * @extends Core.Annotations.ButtonWidgetAnnotation
+   * @param {Core.Annotations.Forms.Field} field - The field to associate with the widget
+   * @param {object} [options] - A map of properties to set on the widget
+   */
+  constructor(field, options) {
+    super(field, options);
+  }
+}

+ 32 - 0
packages/webviewer-core/src/Annotations/RectangleAnnotation.js

@@ -0,0 +1,32 @@
+import MarkupAnnotation from './MarkupAnnotation.js'
+
+/**
+ * @memberof Core.Annotations
+ */
+class RectangleAnnotation extends MarkupAnnotation {
+
+  /**
+   * Represents a rectangle annotation.
+   * @extends Core.Annotations.MarkupAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+  }
+
+  /**
+   * Returns the Border style for the annotation, applicable values are solid (default) and cloudy.
+   * @return {string} value the string value, either solid or cloudy
+   */
+  getBorderStyle() {
+    return this.BorderStyle;
+  }
+
+  /**
+   * Set the Border style for the annotation, applicable values are solid (default) and cloudy.
+   * @param {string} value - the string value, either solid or cloudy
+   */
+  setBorderStyle(value) {
+    this.BorderStyle = value;
+  }
+}

+ 76 - 0
packages/webviewer-core/src/Annotations/SignatureWidgetAnnotation.js

@@ -0,0 +1,76 @@
+import WidgetAnnotation from './WidgetAnnotation.js'
+
+/**
+ * Represents a Signature Widget annotation.
+ * @memberof Core.Annotations
+ */
+class SignatureWidgetAnnotation extends WidgetAnnotation {
+
+  /**
+   * Creates a new instance of SignatureWidgetAnnotation.
+   * @extends Core.Annotations.WidgetAnnotation
+   * 
+   * @param {Core.Annotations.Forms.Field} field - The field to associate with the widget
+   * @param {object} [options] - A map of properties to set on the widget
+   * 
+   * @property {function} createSignHereElement - A function that creates the sign here element in the annotation. This can be replaced with your own function.
+   * @property {object} annot - The annotation associated with the signature widget.
+   */
+  constructor(field, options) {
+    super(options);
+    this.field = field;
+    this.createSignHereElement = options?.createSignHereElement;
+
+    /** Get or set the annotation associated with the signature widget. */
+    this.annot = options?.annot;
+  }
+
+  /**
+   * Removes a signature from a signed signature widget and redraws it
+   * @param {Core.AnnotationManager} annotationManager - A reference to the annotation manager used to redraw the signature widget
+   */
+  clearSignature(annotationManager) {}
+
+  /**
+   * Signs the signature widget by adding a custom appearance from an annotation
+   * @param {Core.Annotations.FreeHandAnnotation|Core.Annotations.StampAnnotation} annotation - a freehand annotation or a stamp annotation to create the appearance from
+   * @param {Core.AnnotationManager} annotationManager - A reference to the annotation manager used to add the appearance
+   */
+  createSignatureAppearance(annotation, annotationManager) {}
+
+  /**
+   * Get the annotation associated with the signature widget.
+   * @return {Core.Annotations.FreeHandAnnotation|Core.Annotations.StampAnnotation} the annotation associated with the signature widget.
+   */
+  getAssociatedSignatureAnnotation() {}
+
+  /**
+   * Returns a boolean value indicating whether the signature widget has been signed by an appearance
+   * @return {boolean} Whether or not the signature widget has a signature appearance
+   */
+  isSignedByAppearance() {}
+
+  /**
+   * Returns a promise that will be resolved with a boolean value indicating whether the signature widget is signed digitally by default
+   * @return {Promise.<any>}
+   */
+  isSignedDigitally() {}
+
+  /**
+   * Returns true if the Widget is setup to take Initials
+   * @return {boolean} Boolean representing whether this widget is setup for initials or signatures. Based on this flag it will either render the "Sign Here" text handler or "Initials"
+   */
+  requiresInitials() {}
+
+  /**
+   * Get the annotation associated with the signature widget.
+   * @param {Core.Annotations.FreeHandAnnotation | Core.Annotations.StampAnnotation} associatedSignatureAnnotation - a freehand annotation or a stamp annotation 
+   */
+  setAssociatedSignatureAnnotation(associatedSignatureAnnotation) {}
+
+  /**
+   * Signs a signature widget by adding a signature annotation that is rotated and resized accordingly.
+   * @param {Core.Annotations.FreeHandAnnotation | Core.Annotations.StampAnnotation} signature - a freehand annotation or a stamp annotation to sign with.
+   */
+  sign(signature) {}
+}

+ 103 - 0
packages/webviewer-core/src/Annotations/StampAnnotation.js

@@ -0,0 +1,103 @@
+import MarkupAnnotation from './MarkupAnnotation.js'
+
+/**
+ * @memberof Core.Annotations
+ */
+class StampAnnotation extends MarkupAnnotation {
+
+  /**
+   * Represents the different stamp icon names that you can use in the useStamp function of RubberStampCreateTool.
+   * @property {string} APPROVED - Stamp shows Approved
+   * @property {string} AS_IS - Stamp shows As Is
+   * @property {string} COMPLETED - Stamp shows Completed
+   * @property {string} CONFIDENTIAL - Stamp shows Confidential
+   * @property {string} DEPARTMENTAL - Stamp shows Departmental
+   * @property {string} DRAFT - Stamp shows Draft
+   * @property {string} EXPERIMENTAL - Stamp shows Experimental
+   * @property {string} EXPIRED - Stamp shows Expired
+   * @property {string} FINAL - Stamp shows Final
+   * @property {string} FOR_COMMENT - Stamp shows For Comment
+   * @property {string} FOR_PUBLIC_RELEASE - Stamp shows For Public Release
+   * @property {string} INFORMATION_ONLY - Stamp shows Information Only
+   * @property {string} NOT_APPROVED - Stamp shows Not Approved
+   * @property {string} NOT_FOR_PUBLIC_RELEASE - Stamp shows Not For Public Release
+   * @property {string} PRELIMINARY_RESULTS - Stamp shows Preliminary Results
+   * @property {string} SB_REJECTED - Stamp shows Rejected
+   * @property {string} SH_ACCEPTED - Stamp shows Accepted
+   * @property {string} SH_INITIAL_HERE - Stamp shows Initial Here
+   * @property {string} SH_SIGN_HERE - Stamp shows Sign Here
+   * @property {string} SH_WITNESS - Stamp shows Witness
+   * @property {string} SOLD - Stamp shows Sold
+   * @property {string} TOP_SECRET - Stamp shows Top Secret
+   * @property {string} VOID - Stamp shows Void
+   */
+  static IconNames = {
+    APPROVED: 'APPROVED',
+    AS_IS: 'AS_IS',
+    COMPLETED: 'COMPLETED',
+    CONFIDENTIAL: 'CONFIDENTIAL',
+    DEPARTMENTAL: 'DEPARTMENTAL',
+    DRAFT: 'DRAFT',
+    EXPERIMENTAL: 'EXPERIMENTAL',
+    EXPIRED: 'EXPIRED',
+    FINAL: 'FINAL',
+    FOR_COMMENT: 'FOR_COMMENT',
+    FOR_PUBLIC_RELEASE: 'FOR_PUBLIC_RELEASE',
+    INFORMATION_ONLY: 'INFORMATION_ONLY',
+    NOT_APPROVED: 'NOT_APPROVED',
+    NOT_FOR_PUBLIC_RELEASE: 'NOT_FOR_PUBLIC_RELEASE',
+    PRELIMINARY_RESULTS: 'PRELIMINARY_RESULTS',
+    SB_REJECTED: 'SB_REJECTED',
+    SH_ACCEPTED: 'SH_ACCEPTED',
+    SH_INITIAL_HERE: 'SH_INITIAL_HERE',
+    SH_SIGN_HERE: 'SH_SIGN_HERE',
+    SH_WITNESS: 'SH_WITNESS',
+    SOLD: 'SOLD',
+    TOP_SECRET: 'TOP_SECRET',
+    VOID: 'VOID'
+  }
+
+  /**
+   * Represents a stamp annotation.
+   * @extends Core.Annotations.MarkupAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+
+    /** Gets or sets the type of the stamp. */
+    this.Icon = initializer?.Icon;
+  }
+
+  /**
+   * Asynchronously returns the image data URL
+   * @return {Promise.<string>} a promise that resolves to the image data URL
+   */
+  getImageData() {}
+
+  /**
+   * If this instance of a Stamp Annotation was originally created with a URL in WebViewer, the corresponding URL will be returned
+   * @return {string} The URL where this stamp originated from
+   */
+  getOriginalURL() {}
+
+  /**
+   * Gets the stamp's text
+   * @returns {string}
+   */
+  getStampText() {}
+
+  /**
+   * Asynchronously sets the image URL of the stamp annotation
+   * @param {string} imageDataUrl - the data URL of the image
+   * @param {boolean} [keepAsSVG=false] - If image is an SVG data URL then by default it will be converted to PNG to work with other PDF viewers. If this parameter is true then it will not be converted and remain as SVG but will not be visible in other PDF viewers after downloading.
+   * @return {Promise.<void>} a promise that resolves when the image data URL has been set
+   */
+  setImageData(imageDataUrl, keepAsSVG) {}
+
+  /**
+   * Sets the stamp's text
+   * @param {string} text 
+   */
+  setStampText(text) {}
+}

+ 28 - 0
packages/webviewer-core/src/Annotations/StickyAnnotation.js

@@ -0,0 +1,28 @@
+import MarkupAnnotation from './MarkupAnnotation.js'
+
+/**
+ * @memberof Core.Annotations
+ */
+class StickyAnnotation extends MarkupAnnotation {
+
+  /** The size of the width and height of all sticky annotations */
+  static SIZE = 10;
+
+  /**
+   * Represents a sticky annotation.
+   * @extends Core.Annotations.MarkupAnnotation
+   * @param {object} [initializer] - A map of values to auto-initialize certain properties of the annotation. You can only initialize properties defined on the annotation under the Members section (unless specified otherwise).
+   */
+  constructor(initializer) {
+    super(initializer);
+
+    /** The name of the icon to use for this sticky annotation. */
+    this.Icon = initializer?.Icon;
+
+    /** Gets or sets the state of the annotation. Annotations may have an author-specific state associated with them. State include: Accepted, Rejected, Cancelled, Completed, None. */
+    this.State = initializer?.State;
+
+    /** Gets or sets the statemodel of the annotation. Statemodel has two statemodels: Marked, Review. Under Marked, state expands to: Marked, Unmarked. */
+    this.StateModel = initializer?.StateModel || 'Unmarked';
+  }
+}

+ 189 - 0
packages/webviewer-core/src/Document.js

@@ -0,0 +1,189 @@
+/**
+ * Represents a document.
+ * @memberof Core
+ * @extends Core.EventHandler
+ */
+class Document extends EventHandler {
+  /**
+   * Constructs a new empty Document, representing a document with individual pages (canvases) that can be displayed on screen and printed.
+   * @param {string} id - Unique string identifier for the document
+   * @param {string} type - The type of document that should be instantiated. Values are 'xod' for XOD documents, 'pdf' for PDF, JPG or PNG documents, 'office' for MS Office documents and 'webviewerServer' for WebViewer Server documents
+   */
+  constructor(id, type) {}
+
+  /**
+   * An enum representing the toggleable text styles in Office Editor.
+   * @property {string} BOLD - 'bold'
+   * @property {string} ITALIC - 'italic'
+   * @property {string} UNDERLINE - 'underline'
+   */
+  static get OfficeEditorToggleableStyles() {
+    return {
+      BOLD: 'bold',
+      ITALIC: 'italic',
+      UNDERLINE: 'underline'
+    }
+  }
+
+  /**
+   * Register new document type with Document class
+   * @param {string} type - Name of the new document type
+   * @param {any} source - Class of the new document
+   * @param {Array.<string>} exposedFuncs - An array containing strings of the function names to expose on the document object
+   */
+  static registerDocumentType(type, source, exposedFuncs) {}
+
+  /**
+   * Cancels the loadCanvasAsync call corresponding to the passed in id
+   * @param {number} id - The id returned from the loadCanvasAsync call that will be cancelled.
+   */
+  cancelLoadCanvas(id) {}
+
+  /**
+   * Cancels the request made for thumbnail with the specified request Id
+   * @param {number} requestId - The id returned from loadThumbnailAsync
+   */
+  cancelLoadThumbnail(requestId) {}
+
+  /**
+   * [PDF Document only] Extract the given pages from the document. Note that this method will need to wait for the entire file to be downloaded before the change is applied.
+   * @param {Array.<string>} pageArray - an array of the page numbers to extract
+   * @param {string} [xfdfString] - Optional XFDF string to merge into the document before extracting
+   * @returns {Promise.<any>} a promise that resolves on completion
+   */
+  extractPages(pageArray, xfdfString) {}
+
+  /**
+   * Gets the XFDF data for the document's internal annotations.
+   * @returns {Promise.<Core.Document.XFDFInfo>} A promise that resolves to an object with an xfdfString property and a pages property where pages is the array of page numbers that annotations were extracted from
+   */
+  extractXFDF() {}
+  
+  /**
+   * Returns an array containing the bookmarks in the document.
+   * @returns {Promise.<Array.<Core.Bookmark>>} A promise resolving to an array containing the bookmarks in the current document.
+   */
+  getBookmarks() {}
+
+  /**
+   * [PDF/Office Document only] Asynchronously saves the document and provides the result as an ArrayBuffer. To include annotations in the saved document, please provide an object with the xfdfString property.
+   * @param {Object} [options] - An optional object containing save options and parameters.
+   * @param {string} [options.xfdfString] - An xfdf string containing annotation data to be used when saving. This will usually be retrieved by calling exportAnnotations on a Core.AnnotationManager object.
+   * @param {boolean} [options.flatten] - A flag that is only useful when the xfdfString option is used. If true all the annotations in the saved document will be flattened.
+   * @param {boolean} [options.finishedWithDocument] - A flag specifying that the document data may be discarded by the worker after use. Only use this when completely finished with document processing. When handling larger documents this can be useful to avoid memory exhaustion as only one copy of the document needs to be kept.
+   * @param {boolean} [options.printDocument] - If true the saved document data will have an open action specifying that it should be printed. This is mostly only used to trigger print actions in the browser's PDF Viewer.
+   * @param {string} [options.downloadType] - The file type to download as, where the default is the source type. PDF and image files can only be downloaded as PDFs, but office files can be downloaded as "pdf" or as "office" if you want to get the original file without annotations.
+   * @param {number} [options.flags] - The flags with which to save the document. Possible values include Core.SaveOptions.REMOVE_UNUSED (remove unused objects during save) and Core.SaveOptions.LINEARIZED (optimize the document for fast web view and remove unused objects). The default value is Core.SaveOptions.REMOVE_UNUSED.
+   * @param {string} [options.password] - A string representing a password. If a non-empty password is used, the PDF document will be encrypted.
+   * @param {number} [options.encryptionAlgorithmType] - The encryption algorithm identifier. The default value is set to Use Crypt filters with 256-bit AES (Advanced Encryption Standard) algorithm: 4. 40-bit RC4 algorithm: 1, 128-bit RC4 algorithm: 2, Use Crypt filters with 128-bit AES (Advanced Encryption Standard) algorithm: 3, Use Crypt filters with 256-bit AES (Advanced Encryption Standard) algorithm: 4.
+   * @param {boolean} [options.includeAnnotations] - If false, all annotations will be removed from PDF document.
+   * @returns {Promise.<ArrayBuffer>} a promise that resolves to an array buffer containing PDF document bytes.
+   */
+  getFileData(options) {}
+
+  /**
+   * Get the document filename used for downloading.
+   * @returns {string} filename of the document.
+   */
+  getFilename() {}
+
+  /**
+   * Returns the number of pages in a document.
+   * @returns {number} The number of the pages in the current document.
+   */
+  getPageCount() {}
+
+  /**
+   * Returns an object with the original x and y coordinates converted to PDF coordinates for the page.
+   * @param {number} pageNumber - The page number that the coordinates are on
+   * @param {number} x - The x coordinate
+   * @param {number} y - The y coordinate
+   * @returns {object} An object with the x and y PDF coordinates
+   */
+  getPDFCoordinates(pageNumber, x, y) {}
+
+  /**
+   * Returns the PDFNet.PDFDoc object associated with the document. Note that the full API is required to be enabled and WebViewer Server cannot be enabled.
+   * @returns {Promise.<Core.PDFNet.PDFDoc>} A promise that resolves to the PDFDoc object.
+   */
+  getPDFDoc() {}
+
+  /**
+   * It returns the text that is within the Rect on the given page
+   * @param {number} pageNumber - The page number that the rect is on
+   * @param {Core.Math.Rect} rect - A Rect with x1,y1 representing the top-left and x2,y2 representing the bottom-right
+   * @returns {Promise.<string>} A promise that resolves to the extracted text
+   */
+  getTextByPageAndRect(pageNumber, rect) {}
+
+  /**
+   * [PDF Document only] Inserts blank pages before the given list of pages. Both width and height are in units of PDF points.
+   * @param {Array.<number>} insertBeforeThesePages - array of page numbers before which to insert blanks
+   * @param {number} width - width of the blank pages to insert. By default the width is 612 PDF points.
+   * @param {number} height - height of the blank pages to insert. By default the height is 792 PDF points.
+   * @returns {Promise.<object>} a promise that resolves to an object with info for any pages inserted
+   */
+  insertBlankPages(insertBeforeThesePages, width, height) {}
+
+  /**
+   * [PDF Document only] Inserts a set of pages from the provided Document before a given page number. Note that this method will need to wait for the entire file to be downloaded before the change is applied.
+   * @param {Core.Document} sourceDocument - other document from which to take pages (cannot be the same document)
+   * @param {Array.<number>} [pageArray] - An optional array of page numbers to extract from the given document. If not passed in, will insert all pages. 
+   * @param {number} [insertBeforeThisPage] - An optional page number before which to insert the pages. If not passed in, will append to the end.
+   * @returns {Promise.<object>} a promise that resolves to an object describing the updated state of the pages in the document
+   */
+  insertPages(sourceDocument, pageArray, insertBeforeThisPage) {}
+
+  /**
+   * Gets all the text on the requested page.
+   * @param {number} pageNumber - The page number that the text is on.
+   * @returns {Promise.<string>} A promise that resolves with the page's text.
+   */
+  loadPageText(pageNumber) {}
+
+  /**
+   * [PDF Document only] Merge a file into the currently opened document
+   * @param {string|File|ArrayBuffer|Blob} source - Source parameter, path/url to document or File.
+   * @param {number} position - Optional position for where to merge the document, default to end of file if nothing entered
+   * @returns {Promise.<any>} a promise that resolves on completion
+   */
+  mergeDocument(source, position) {}
+
+  /**
+   * [PDF Document only] Moves the pages given in an array so they appear in sequence before a given page number. Note that this method will need to wait for the entire file to be downloaded before the change is applied.
+   * @param {Array.<number>} pageArray - the page numbers to move
+   * @param {number} insertBeforeThisPage - page number before which to insert the other pages
+   */
+  movePages(pageArray, insertBeforeThisPage) {}
+
+  /**
+   * Refresh the text data stored by the viewer. Useful if the text content of the document has changed, e.g. after a redaction.
+   */
+  refreshTextData() {}
+
+  /**
+   * [PDF Document only] Removes the given page numbers. Note that this method will need to wait for the entire file to be downloaded before the change is applied.
+   * @param {Array.<number>} pageArray - the page numbers to remove
+   * @returns {Promise.<object>} a promise that resolves to an object describing the updated state of the pages in the document
+   */
+  removePages(pageArray) {}
+
+  /**
+   * [PDF Document only] Adds the given rotation to the given pages. Note that this method will need to wait for the entire file to be downloaded before the change is applied.
+   * @param {Array.<number>} pageArray - an array of the numbers of pages to rotate
+   * @param {Core.PageRotation} rotation - the page rotation to add
+   * @returns {Promise.<object>} a promise that resolves to an object describing the updated state of the pages in the document
+   */
+  rotatePages(pageArray, rotation) {}
+
+  /**
+   * Set the document filename used for downloading.
+   * @param {string} filename - Filename of the document.
+   */
+  setFilename(filename) {}
+
+  /**
+   * @typedef {object} Core.Document.OfficeEditorTextStyle
+   * @property {boolean} paragraphTextStyle - 
+   */
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 225 - 0
packages/webviewer-core/src/index.js