UNPKG

@mescius/dspdfviewer

Version:
1,112 lines (1,111 loc) 36.2 kB
import { ReplaceTextModel } from "../Models/ViewerTypes"; import { EditMode } from "./types"; /** * Information about signature used in document. **/ export type SignatureInformation = { /** * The flag indicates whether the document is signed. * Note, a document is considered signed if it contains at least * one signature field with the signatureValue property filled in. **/ signed: boolean; /** * An array with signature field(s) which was used to sign the document. * The signedByFields only represents signed signature fields. **/ signedByFields: SignatureAnnotation[]; /** * An array with all available signature fields in the document. * The signatureFields represents all signature fields in a file, whether it is signed or not. **/ signatureFields: SignatureAnnotation[]; }; export type SignatureValueProps = { /** * Signer name. **/ name: string; /** * Signature filter algoritm name. **/ filter: string; /** * Sub-filter name. * @ignore exclude **/ subFilter: string; /** * Signature location. **/ location: string; /** * Signature modification date in PDF format: * "D:YYYYMMDDHHMMSSZ", e.g.: "D:20251205092536Z" - 2025/12/05 09:25:36 * @example * ```javascript * // Convert pdf date string to javascript Date object: * const date = viewer.pdfStringToDate(signatureValue.modificationDate); * ``` **/ modificationDate: string; }; /** * Link annotation type. **/ export type LinkType = 'url' | 'action' | 'dest' | 'js' | 'unknown'; /** * Link destination type. **/ export type LinkDestinationType = 'XYZ' | 'Fit' | 'FitH' | 'FitBH' | 'FitV' | 'FitBV' | 'FitR' | 'FitB'; /** * Named action. Used by link annotation. * See PDF reference, table 8.45 - Named action. **/ export type NamedAction = 'GoBack' | 'GoForward' | 'NextPage' | 'PrevPage' | 'LastPage' | 'FirstPage'; /** * Information about initial rectangle before rotation. **/ export type RotationInit = { /** * Initial annotation rectangle before rotation. Cannot be null or empty. * [x1, y1, x2, y2], equals the content rectangle without rotation. * Rotation origin is center of the rectangle. **/ initRect: number[]; /** * Result annotation rectangle after rotation, [x1, y1, x2, y2] - orientation not changed. **/ rotatedRect?: number[]; /** * Transformed content rectangle after rotation, [x1, y1, x2, y2]. **/ transformedRect?: number[]; /** * Rotation rectangle in degrees. **/ angle: number; /** * Left content offset after rotation. Width difference between initRect and rotatedRect divided by 2. **/ dx?: number; /** * Top content offset after rotation. Height difference between initRect and rotatedRect divided by 2. **/ dy?: number; }; /** * Additional appearance and behavior properties for the input field. * */ export type GcProps = { /** * The autocomplete attribute lets web developers specify what if any permission * the user agent has to provide automated assistance in * filling out form field values, as well as guidance to the * browser as to the type of information expected in the field. * Note, the behavior of this property depends on the browser implementation. * <br />See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete} * <br />See {@link https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill} */ autocomplete?: string | 'on' | 'off' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix' | 'nickname' | 'email' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization' | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2' | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount' | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'tel' | 'tel-country-code' | 'tel-national' | 'tel-area-code' | 'tel-local' | 'tel-local-prefix' | 'tel-local-suffix' | 'tel-extension' | 'impp' | 'url' | 'photo'; /** * Indicates whether a field should automatically get focus when the Form filler dialog is activated or when the page loads. * */ autofocus?: boolean; /** * The default value. * */ defaultvalue?: string; /** * Indicates whether a field is disabled, or not. * */ disabled?: boolean; /** * If your recommended (or required) password syntax rules would benefit from an * alternate text entry interface than the standard keyboard, you can use the inputmode * property to request a specific one. The most obvious use case for this is if the password * is required to be numeric (such as a PIN). Mobile devices with virtual keyboards, for example, * may opt to switch to a numeric keypad layout instead of a full keyboard, to make entering the password easier. * */ inputmode?: 'numeric' | 'string'; /** * Use the displayname property to specify the text that will appear as a field label in the Form Filler dialog box. * Applicable only for the Form Filler dialog box. * */ displayname?: string; /** * The minimum value to accept for the input. * Applicable for date or number input. * */ min?: any; /** * The maximum value to accept for the input. * Applicable for date or number input. * */ max?: any; /** * The maximum number of characters the input should accept. * */ maxlength?: number; /** * The minimum number of characters long the input can be and still be considered valid. * */ minlength?: number; /** * Set this property to true if you want to use multiline text input element. * */ multiline?: boolean; /** * A boolean property which, if present, indicates that the user can enter a * list of multiple e-mail addresses, separated by commas and, optionally, whitespace characters. * */ multiple?: boolean; orderindex?: number; /** * The pattern property specifies a regular expression that the field value is checked against. * @example * pattern for email validation: "\S+@\S+\.\S+" * */ pattern?: string; /** * Represents the placeholder text in an input or textarea element when value is empty. * */ placeholder?: string; /** * Indicates whether the field is read-only, or not. * */ readonly?: boolean; /** * When present, it specifies that an input field must be filled. * */ required?: boolean; /** * The spellcheck property is an enumerated attribute defines whether the element may be checked for spelling errors * Note that the spellcheck property may have limited support by some browser vendors. * <br />See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text#spellcheck} */ spellcheck?: 'true' | 'false'; /** * Use the title property to specify text that most browsers will display as a tooltip. */ title?: string; /** * Representing a localized message that describes the validation constraints * that the control does not satisfy (if any). */ validationmessage?: string; /** * True indicates whether validation should be performed immediately during user input, * otherwise input validation will be performed on blur event. */ validateoninput?: boolean; /** * State of the input type attribute. * <br />See {@link https://html.spec.whatwg.org/} section "4.10.5 The input element" for other input types. */ type?: 'text' | 'date' | 'time' | 'month' | 'week' | 'number' | 'tel' | 'search' | 'textarea' | string; }; export type CopyBufferData = { type: 'annotation' | 'empty'; data?: { pageIndex: number; annotation: AnnotationBase; }; }; /** * Annotation state model. **/ export type AnnotationStateModel = 'Marked' | 'Review'; /** * Marked states. **/ export type AnnotationMarkedStateType = 'Marked' | 'Unmarked'; /** * Review states. **/ export type AnnotationReviewStateType = 'None' | 'Accepted' | 'Cancelled' | 'Completed' | 'Rejected'; /** * Annotation type name. **/ export type AnnotationTypeName = ('Text' | 'Link' | 'FreeText' | 'Line' | 'Square' | 'Circle' | 'Polygon' | 'PolyLine' | 'Highlight' | 'Underline' | 'Squiggly' | 'Strikeout' | 'StrikeOut' | 'Stamp' | 'Caret' | 'Ink' | 'Popup' | 'FileAttachment' | 'Sound' | 'Movie' | 'Widget' | 'Screen' | 'PrinterMark' | 'TrapNet' | 'WaterMark' | 'Redact' | 'Signature' | 'ThreadBead' | 'RadioButton' | 'Checkbox' | 'PushButton' | 'Choice' | 'TextWidget' | 'RichMedia' | 'ReplaceText'); /** * Field widget type. * Tx - text field * Btn - button field * Ch - choice widget field * */ export type WidgetFieldTypeName = ('Tx' | 'Btn' | 'Ch'); /** * Line end style. * */ export type LineEndStyle = ("Square" | "Circle" | "Diamond" | "OpenArrow" | "ClosedArrow" | "None" | "Butt" | "ROpenArrow" | "RClosedArrow" | "Slash"); /** * Annotation type code. * */ export declare enum AnnotationTypeCode { TEXT = 1, LINK = 2, FREETEXT = 3, LINE = 4, SQUARE = 5, CIRCLE = 6, POLYGON = 7, POLYLINE = 8, HIGHLIGHT = 9, UNDERLINE = 10, SQUIGGLY = 11, STRIKEOUT = 12, STAMP = 13, CARET = 14, INK = 15, POPUP = 16, FILEATTACHMENT = 17, SOUND = 18, MOVIE = 19, WIDGET = 20, SCREEN = 21, PRINTERMARK = 22, TRAPNET = 23, WATERMARK = 24, THREED = 25, REDACT = 26, SIGNATURE = 27, RICHMEDIA = 90, THREADBEAD = 150, REPLACETEXT = 500 } /** * Text alignment. * */ export declare enum TextAlignmentType { Left = 0, Center = 1, Right = 2 } export declare function isStatusTextAnnotation(item: TextAnnotation): boolean; export declare function isFormFieldWidget(item: AnnotationBase): boolean; export declare function isRadioButtonFieldWidget(item: AnnotationBase): boolean; export declare function findFieldObjectType(node: WidgetAnnotation): string; export declare function findAnnotationSubType(annotationType: AnnotationTypeCode, defaultValue: string | AnnotationTypeName): AnnotationTypeName; export declare function getAnnotationOptionsKeyName(annotation: AnnotationBase): string; /** * Toolbar button key. **/ export type ToolbarButtonKey = 'edit-select' | 'share' | 'edit-text' | 'edit-free-text' | 'edit-ink' | 'edit-square' | 'edit-circle' | 'edit-line' | 'edit-polyline' | 'edit-polygon' | 'edit-stamp' | 'edit-file-attachment' | 'edit-richmedia' | 'edit-sound' | 'edit-link' | "edit-highlight" | "edit-underline" | "edit-squiggly" | "edit-strike-out" | "edit-caret" | "edit-movie" | "edit-printer-mark" | "edit-trap-net" | "edit-watermark" | "edit-3d" | "edit-projection" | "edit-rich-media" | 'edit-redact' | 'edit-redact-apply' | 'edit-replace-text' | 'edit-erase' | 'edit-undo' | 'edit-redo' | 'new-document' | 'new-page' | 'delete-page' | 'edit-select-field' | 'share' | 'edit-widget-tx-field' | 'edit-widget-tx-password' | 'edit-widget-tx-text-area' | 'edit-widget-btn-checkbox' | 'edit-widget-btn-radio' | 'edit-widget-btn-push' | 'edit-widget-ch-combo' | 'edit-widget-ch-list-box' | 'edit-widget-tx-comb' | 'edit-widget-btn-submit' | 'edit-widget-btn-reset' | 'edit-erase-field' | 'edit-undo' | 'edit-redo' | 'new-document' | 'new-page' | 'delete-page' | 'edit-sign-tool' | 'open' | 'download' | 'save' | 'text-selection' | 'pan' | 'text-tools' | 'draw-tools' | 'attachment-tools' | 'form-tools' | 'page-tools' | 'pdf-organizer' | 'rotate' | 'view-mode' | 'theme-change' | 'print' | 'hide-annotations' | 'form-filler' | 'doc-title' | 'doc-properties' | 'about' | '$split' | 'zoom' | '$zoom' | '$navigation' | '$fullscreen'; export declare function edtorModeToButtonKey(editorMode: EditMode): ToolbarButtonKey; /** * Base class for all annotation models. **/ export declare class AnnotationBase { /** * Hash object with information about users who change this annotation. * key - user name * value - UNIX UTC timestamp when changes were added. * */ sharedChanges?: { [userName: string]: number; }; /** * Annotation id. * */ id: string; /** * Annotation name (NM entry). * */ annotationName: string; /** * Indicates whether the annotation will be converted to content when the document is saved. * */ convertToContent?: boolean; /** * The field is used for compatibility with Adobe Acrobat Reader. **/ display?: 'visible' | 'hidden'; /** * The field order index. **/ orderIndex: number; /** * @ignore **/ annotationFlags: number; /** * Annotation type. */ annotationType: AnnotationTypeCode; /** * Annotation's border style. */ borderStyle?: { /** * Border width. **/ width: number; /** * Border style. Possible values: 1 - solid style (default), 2 - dashed style. **/ style: number; /** * Border dash pattern. Used when the border style is dashed. **/ dashArray?: number[]; horizontalCornerRadius: number; verticalCornerRadius: number; }; /** * Appearance color. **/ appearanceColor?: string; /** * Annotation color. **/ color?: string; /** * The text (or rich text) string that shall be displayed in the pop-up when the annotation is opened. **/ contents?: string; /** * If set, do not rotate the annotation’s appearance to match the rotation of the page. * The upper-left corner of the annotation rectangle shall remain in a fixed location on the page, * regardless of the page rotation. * The upper-left corner of the annotation remains at the same point in default user space; the annotation pivots around that point. * Note, Text annotations shall not scale and rotate with the page; they shall behave as if the NoRotate (and NoZoom) annotation flag were always set. * @ignore exclude from docs. **/ noRotateFlag?: boolean; /** * Annotation opacity. **/ opacity?: number; /** * * @ignore exclude from docs */ pageIndex?: number; /** * The alignment of the text. */ textAlignment: TextAlignmentType; /** * Specifies whether or not the RichContent mode is used for the contents property. */ isRichContents: boolean; /** * Annotation sub-type. Possible values are: 'Text', 'Link', 'FreeText', 'Line', 'Square', 'Circle', 'Polygon', 'PolyLine', * 'Highlight', 'Underline', 'Squiggly', 'Strikeout', 'Stamp', 'Caret', 'Ink', 'Popup', 'FileAttachment', * 'Sound', 'Movie', 'Widget', 'Screen', 'PrinterMark', 'TrapNet', 'WaterMark', * 'Redact', 'Signature', 'ThreadBead', 'RadioButton', 'Checkbox', 'PushButton', 'Choice', 'TextWidget', * 'RichMedia' */ subtype: AnnotationTypeName; /** * The text label that shall be displayed in the title bar of * the annotation's popup when open and active. This entry shall identify * the user who added the annotation. */ title: string; /** * Text representing a short description of the subject being addressed by the annotation. * The 'subject' is the meta information property and it can be used to group, * sort or filter annotations. */ subject: string; /** * The annotation's bounds rectangle: [x1, y1, x2, y2]. * (0, 0) is the bottom left corner of the page. **/ rect: number[]; quadPoints?: { x: number; y: number; }[][]; /** * Normal appearance bounds rectangle: [x1, y1, x2, y2]. * @ignore exclude from docs **/ appearanceBBox: number[]; /** * Internal property. * @ignore * */ useCustomAppearance: boolean; /** * Specifies whether or not the annotation can be printed. */ printableFlag: boolean; /** * Creation date. * */ creationDate: string; /** * Modification date. * */ modificationDate: string; /** * Popup id if any. * */ popupId?: string; /** * Parent annotation id for popup annotation. * */ parentId?: string; /** * Resolved reference to parent annotation. * */ parentAnnotation?: AnnotationBase; /** * Resolved reference to popup annotation. * */ /** * R - this annotation is reply to the primary annotation specified by field referenceAnnotationId. * Group - annotation should be grouped with primary annotation specified by field referenceAnnotationId. * */ referenceType: 'R' | 'Group'; /** * Id of the primary annotation to which this annotation belongs. ("in reply to" value). **/ referenceAnnotationId: string; /** * The number of degrees by which the annotation shall be rotated relative to the page. **/ rotate?: number; /** * Calculated rectangles before and after rotation. * @ignore exclude from docs. **/ rotationInit?: RotationInit; /** * Internal helper property. * Primary annotation's children annotations. * Note, the array contains all children annotations, including annotations what is not direct descendant of the primary annotation. * */ irtAnnotations?: AnnotationBase[]; /** * Beginning with PDF 1.5, Annotations may have author-specific state associated with them. * The state is not specified in the annotation itself but in separate text annotation that * refers to the original annotation by means of its 'IRT' ("in reply to") entry. * */ state?: AnnotationMarkedStateType | AnnotationReviewStateType; /** * The state model corresponding to state. * */ stateModel?: AnnotationStateModel; /** * true if the annotation is hidden. * */ invisibleFlag: boolean; /** * Specifies whether the annotation can be deleted or its properties (including position and size) can be modified by the user. * @example * ```javascript * var viewer = new DsPdfViewer('#root', { renderInteractiveForms: true , supportApi: { apiUrl: 'api/pdf-viewer', webSocketUrl: false } }); * viewer.addDefaultPanels(); * viewer.addAnnotationEditorPanel(); * viewer.addFormEditorPanel(); * viewer.addReplyTool(); * viewer.onAfterOpen.register(()=>{ * // Lock all text annotations after document open: * const resultArr = await viewer.findAnnotation(1, // 1 - AnnotationTypeCode.TEXT * { findField: 'annotationType', * pageNumberConstraint: 1, findAll: true }); * viewer.updateAnnotations(0, resultArr.map((data)=> { data.annotation.locked = true; return data.annotation; })); * }); * // Open Annotations.pdf * viewer.open('Annotations.pdf'); * ``` **/ locked: boolean; /** * Gets or sets a value indicating whether the contents of the annotation can be modified by the user. * This flag does not restrict deletion of the annotation or changes to other annotation properties, * such as position and size. * @ignore exclude from docs. **/ lockedContents: boolean; /** * Internal property, used by control. * @ignore exclude from docs **/ __stateVersion: number; /** * ID of the Redact annotation that was used to redact the current annotation. **/ redactedBy: string; /** * Indicates whether the current annotation has been redacted. * Redacted annotations will be removed from the document after saving. **/ redacted: boolean; constructor(); } /** * A popup annotation (PDF 1.3) displays text in a popup window for entry and editing. * It shall not appear alone but is associated with a markup annotation, its parent annotation, * and shall be used for editing * the parent’s text. It shall have no appearance stream or associated actions of its own and shall be * identified by the Popup entry in the parent’s annotation dictionary * */ export declare class PopupAnnotation extends AnnotationBase { /** * Specifies whether to open the popup initially. **/ open: boolean; constructor(); } /** * Base class for all markup annotations. * */ export declare class MarkupAnnotation extends AnnotationBase { /** * Indicates if annotation has associated popup annotation. * */ hasPopup: boolean; /** * Popup annotation identifier. * */ popupId: string; constructor(); } /** * Line annotation. * */ export declare class LineAnnotation extends MarkupAnnotation { /** * Line coordinates array - four points: x1, y1, x2, y2. Origin is bottom left. **/ lineCoordinates: number[]; /** * Interior color. **/ interiorColor?: string; /** * Line start type. * @default 'None' **/ lineStart: LineEndStyle; /** * Line end type. * @default 'None' **/ lineEnd: LineEndStyle; constructor(); } /** * PolyLine annotation. **/ export declare class PolyLineAnnotation extends MarkupAnnotation { /** * PolyLine vertices points. **/ vertices: { x: number; y: number; }[]; /** * Interior color. **/ interiorColor?: string; constructor(); } /** * Polygon annotation. * */ export declare class PolygonAnnotation extends PolyLineAnnotation { constructor(); } /** * Circle annotation. * */ export declare class CircleAnnotation extends MarkupAnnotation { /** * The x-axis coordinate of the center of the circle. **/ cx: number; /** * The y-axis coordinate of the center of the circle. **/ cy: number; /** * The radius on the x-axis. **/ rx: number; /** * The radius on the y-axis. **/ ry: number; /** * Interior color. **/ interiorColor?: string; constructor(); } /** * Square annotation. **/ export declare class SquareAnnotation extends MarkupAnnotation { /** * Interior color. **/ interiorColor?: string; constructor(); } /** * Highlight annotation. **/ export declare class HighlightAnnotation extends MarkupAnnotation { constructor(); } /** * Underline annotation. **/ export declare class UnderlineAnnotation extends MarkupAnnotation { constructor(); } /** * Squiggly-underline annotation **/ export declare class SquigglyAnnotation extends MarkupAnnotation { constructor(); } /** * Strikeout annotation **/ export declare class StrikeOutAnnotation extends MarkupAnnotation { constructor(); } /** * Redact annotation. **/ export declare class RedactAnnotation extends MarkupAnnotation { /** * Marked state border color. **/ markBorderColor?: string; /** * Marked state fill color. **/ markFillColor?: string; /** * Overlay fill color. **/ overlayFillColor?: string; /** * Overlay text. **/ overlayText?: string; /** * Overlay text justification. **/ overlayTextJustification?: TextAlignmentType; /** * Overlay text repeat. **/ overlayTextRepeat?: boolean; /** * The redactApplied property indicates that the content areas under the Redact annotation should be deleted. **/ redactApplied: boolean; constructor(); } /** * Represents an annotation for the ReplaceText feature. * Note that this annotation is not described in the PDF specification and is not embedded in the content of the PDF document. * Instead, we use this annotation for replacing text content when the PDF document is saved. */ export declare class ReplaceTextAnnotation extends MarkupAnnotation { /** * Creates an instance of ReplaceTextAnnotation. */ constructor(replaceData: ReplaceTextModel); /** * Data model containing the new text, the text to be replaced, and the coordinates of the selected text. */ replaceData: ReplaceTextModel; } /** * Ink annotation. * */ export declare class InkAnnotation extends MarkupAnnotation { /** * An array of n arrays, each representing a stroked path. * Each array is a series of alternating horizontal and vertical coordinates, * specifying points along the path. * When drawn, the points will be connected by curves. **/ inkLists: { x: number; y: number; }[][]; constructor(); } /** * Link annotation. **/ export declare class LinkAnnotation extends MarkupAnnotation { linkType?: LinkType; url: string; newWindow: boolean; dest: (object | number | null)[]; destType?: LinkDestinationType; destX: number; destY: number; destW: number; destH: number; destScale: number | 'page-fit' | 'page-width' | 'page-height'; destPageNumber?: number; action: NamedAction; jsAction: string; constructor(); } /** * Text annotation. * */ export declare class TextAnnotation extends MarkupAnnotation { static DEFAULT_WIDTH: number; static DEFAULT_HEIGHT: number; /** * Initially opened state. * */ open: boolean; /** * Icon name. * @default 'Comment' * */ name: 'Comment' | 'Key' | 'Note' | 'Help' | 'NewParagraph' | 'Paragraph' | 'Insert'; /** * The State to which original annotation should be set. * */ state?: AnnotationMarkedStateType | AnnotationReviewStateType; /** * The sateModel corresponding to State. * */ stateModel?: AnnotationStateModel; /** * Internal helper property. * The State to which original annotation is set by current user. * */ displayState: AnnotationMarkedStateType | AnnotationReviewStateType; isRichContents: boolean; constructor(); } /** * FreeText annotation. * */ export declare class FreeTextAnnotation extends MarkupAnnotation { calloutLine: number[]; calloutLineEnd: LineEndStyle; isRichContents: boolean; /** * Font size. **/ fontSize: number; /** * Font name. * Available standard font names: * 'Helv' (Helvetica), 'HelveticaItalic' (Helvetica Italic), 'HelveticaBold' (Helvetica Bold), * 'HelveticaBoldItalic' (Helvetica Bold Italic), * 'TimesRegular' (Times Roman), 'TimesItalic' (Times Roman Italic), * 'TimesBold' (Times Roman Bold), 'TimesBoldItalic' (Times Roman Bold Italic), * 'CourierRegular' (Courier), 'CourierItalic' (Courier Italic), 'CourierBold' (Courier Bold), * 'CourierBoldItalic' (Courier Bold Italic), 'Symbol' (Text symbol letters) * @default "Helvetica" **/ fontName: string; constructor(); } /** * Signature field widget annotation. **/ export declare class SignatureAnnotation extends MarkupAnnotation { /** * Image file identifier. * @example * ```javascript * // Get signature image data: * const imageData = viewer.storage.getItem(signatureAnnotation.fileId); * ``` * @ignore exclude from docs **/ fileId?: string; /** * @ignore exclude from docs **/ fileIdChanged?: boolean; /** * File name. * @ignore exclude from docs **/ fileName?: string; /** * Field type. * @ignore exclude from docs **/ fieldType?: "Sig"; /** * Signature value. If filled, means that the document has * been signed using the current signature field. **/ signatureValue?: SignatureValueProps; constructor(); } /** * Stamp annotation. **/ export declare class StampAnnotation extends MarkupAnnotation { /** * Image file identifier. * @example * ```javascript * // Get stamp image data: * const imageData = viewer.storage.getItem(stampAnnotation.fileId); * ``` **/ fileId?: string; /** * @ignore exclude from docs **/ fileIdChanged?: boolean; /** * File name. * @ignore **/ fileName?: string; constructor(); } /** * FileAttachment annotation. * */ export declare class FileAttachmentAnnotation extends MarkupAnnotation { /** * Icon type name. **/ name: 'Graph' | 'PushPin' | 'Paperclip' | 'Tag'; /** * File name. **/ fileName?: string; /** * File attachment identifier. * @example * ```javascript * // Get file attachment data: * const fileData = viewer.storage.getItem(annotation.fileId); * ``` **/ fileId?: string; /** * @ignore exclude from docs **/ fileIdChanged?: boolean; /** * The size of the attachment in bytes. * An undefined value or a value of 0 means that no file data is attached to the annotation. **/ fileLength?: number; /** * Internal property. * @ignore **/ isNew?: boolean; /** * Internal property. * @ignore **/ file: any; constructor(); } /** * Sound annotation. * */ export declare class SoundAnnotation extends MarkupAnnotation { /** * The icon appearance type. **/ name: 'Ear' | 'Speaker' | 'Mic'; /** * @ignore **/ soundBytes: Uint8Array; /** * Audio metadata. Available only if audio is embedded in the PDF initially. **/ audioProperties: { numChannels: 1 | 2 | number; sampleRate: number; bytesPerSample: 2 | 8 | 32 | 128 | 256 | number; subchunk2Size: 538100 | number; }; /** * Audio metadata. Available only if audio is embedded in the PDF initially. **/ playerOptions: { encoding: "16bitInt"; channels: 1 | 2 | number; sampleRate: 44100 | number; }; /** * File name. * @ignore **/ fileName?: string; /** * Audio file identifier. **/ fileId?: string; /** * @ignore exclude from docs **/ fileIdChanged?: boolean; constructor(); } /** * Base class for all widget annotations. **/ export declare class WidgetAnnotation extends AnnotationBase { /** * Field type. **/ fieldType: WidgetFieldTypeName; /** * Field name. **/ fieldName: string; /** * Field widget value. **/ fieldValue: string | string[]; /** * An alternate field text to be used as tooltip. * This text is also useful when extracting the document’s contents in support of accessibility * to users with disabilities or for other purposes. **/ alternativeText?: string; /** * Font size. **/ fontSize: number; /** * Font name. * Available standard font names: * 'Helv' (Helvetica), 'HelveticaItalic' (Helvetica Italic), 'HelveticaBold' (Helvetica Bold), * 'HelveticaBoldItalic' (Helvetica Bold Italic), * 'TimesRegular' (Times Roman), 'TimesItalic' (Times Roman Italic), * 'TimesBold' (Times Roman Bold), 'TimesBoldItalic' (Times Roman Bold Italic), * 'CourierRegular' (Courier), 'CourierItalic' (Courier Italic), 'CourierBold' (Courier Bold), * 'CourierBoldItalic' (Courier Bold Italic), 'Symbol' (Text symbol letters) * @default "Helv" **/ fontName: string; /** * Additional custom properties. * Only available for use with DsPdf. **/ gcProps?: GcProps; /** * The number of degrees by which the widget annotation shall be rotated counterclockwise relative to the page. * The value shall be a multiple of 90. Default value: 0. **/ orientation?: number; /** * Read-only flag. **/ readOnly: boolean; constructor(); } /** * Text field widget. * */ export declare class TextWidget extends WidgetAnnotation { /** * When the autoSizeFont flag is set, the text widget will resize the text to fit within the widget's bounds. **/ autoSizeFont?: boolean; multiLine: boolean; comb: boolean; maxLen: number; hasPasswordFlag: boolean; backgroundColor: string; borderColor: string; required: boolean; constructor(); } /** * Button field widget. * */ export declare class ButtonWidget extends WidgetAnnotation { /** * If set, indicates that this button is a checkbox. **/ checkBox: boolean; /** * If set, indicates that this button is a radio button. **/ radioButton: boolean; /** * If set, indicates that this button is a push button. **/ pushButton: boolean; /** * If set, indicates that this button is used to submit form. **/ submitForm: boolean; /** * If set, indicates that this button is used to reset form. **/ resetForm: boolean; /** * Export button value, used by radio buttons. * @deprecated Deprecated in favor of exportValue. **/ protected get buttonValue(): string; protected set buttonValue(v: string); /** * Export value, used by radio/checkbox buttons. **/ exportValue: string; /** * If set, a group of radio buttons with same name (within a radio button field) that * use the same value for the on state see:exportValue will turn on and off in unison; * that is if one is checked, they are all checked. * If clear, the buttons are mutually exclusive (the same behavior as HTML radio buttons). * @default false **/ radiosInUnison: boolean; /** * @ignore Exclude from docs. The property is used only for design time editor. **/ checked?: boolean; constructor(); } /** * Choice field widget. **/ export declare class ChoiceWidget extends WidgetAnnotation { /** * Combo box field flag. **/ combo: boolean; /** * List box flag. **/ multiSelect: boolean; /** * Choice options. **/ options: { displayValue: string; exportValue: string; }[]; /** * Gets or sets a value indicating whether the combo box includes an editable text * box as well as a drop-down list. **/ hasEditFlag: boolean; constructor(); } export declare function getAnnotationDisplayTitle(node: AnnotationBase, in17n: any, includeDecorator?: boolean): string; export declare function getAnnotationDisplayName(node: AnnotationBase, in17n: any, includeDecorator?: boolean): string; export declare function getAnnotationIconKey(node: AnnotationBase): { annotationIconKey: string; defaultAnnotationIconKey: string; };