@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
1,050 lines (1,048 loc) • 41.5 kB
TypeScript
//@ts-ignore
/// <reference types="react" />
//@ts-ignore
import { PluginModel, DocumentMoniker, /*ToolbarItem, ViewMode,*/ SearchFeature, Model, LoadResult, Store, EventFan, ZoomSettings } from '@grapecity/viewer-core';
import * as Articles from './Articles';
import * as Annotations from './Annotations';
import { ParameterInfo } from './GcPdfDocument';
import { GcPdfSearcher } from './Search/GcPdfSearcher';
import * as Search from './Search/SearchPanel';
import { GcPdfPrintProgress } from './Print/GcPdfPrintProgress';
import { GcPdfPasswordDialog } from './Password/GcPdfPasswordDialog';
import { PropertiesDialog } from './Properties/PropertiesDialog';
import { ConfirmationDialog } from './Dialogs/ConfirmationDialog';
import { SignToolSettings, ViewerOptions } from './ViewerOptions';
import { GcPdfViewer } from './GcPdfViewer';
import { ArticleBead } from './Articles/types';
import { GcPdfViewerStateStorage } from './GcPdfViewerStateStorage';
import { ShortcutsConfig } from './Keyboard/ShortcutsConfig';
import { DocumentInformation } from './Properties/DocumentInformation';
import { DocumentSecuritySummary } from './Security/DocumentSecuritySummary';
import { ISupportApi } from './SupportApi/ISupportApi';
import { AnnotationsModel, LayoutMode, EditMode } from './Annotations/types';
import { AnnotationBase, AnnotationTypeCode, TextAnnotation, AnnotationMarkedStateType, AnnotationReviewStateType, CopyBufferData, WidgetAnnotation } from './Annotations/AnnotationTypes';
//@ts-ignore
import { ContextMenuProvider } from '@grapecity/core-ui';
import { ProgressDialog } from './Dialogs/ProgressDialog';
/// <reference path="vendor/i18next.d.ts" />
//@ts-ignore
import { i18n } from 'i18next';
import { DocumentList } from './DocumentListPanel';
import { GcDocumentContextMenu } from './ContextMenu/GcDocumentContextMenu';
import { GcSelectionPoint } from './Models/GcMeasurementTypes';
import { GcRightSidebar } from './RightSidebar/GcRightSidebar';
import { ReplyToolModel } from './ReplyTool/types';
import { GcRightSidebarState } from './RightSidebar/types';
import { SharedDocuments } from './SharedDocuments/SharedDocumentsPanel';
import { ShareDialog } from './SharedDocuments/ShareDialog';
import { LogLevel, ModificationsState, SharedAccessMode } from './SharedDocuments/types';
import { FormFillerDialog } from './FormFiller/FormFillerDialog';
import { LeftSidebar } from './LeftSidebar';
//@ts-ignore
import { ErrorSeverity, PanelHandle } from '@grapecity/viewer-core/types/api/PluginModel';
import { SignToolDialog } from './SignTool/SignToolDialog';
import { FloatingBar } from './FloatingBar/FloatingBar';
import { IGcVisiblePagesInfo, OpenParameters, OptionalContentConfig, PageViewport, SaveSettings, ViewerFeatureName, ViewerPreferences, OpenAction, DocumentListItem, SubmitFormOptions, ScrollPageIntoViewOptions, IAutoScrollHelper } from './Models/ViewerTypes';
import { GcPdfViewerDataLoader } from './Core/GcPdfViewerDataLoader';
import { ReportAction, ReportEvent } from './Models/PluginTypes';
import { StampImagesAwaiter } from './Utils/StampImagesAwaiter';
import { AfterOpenEventArgs, BeforeOpenEventArgs, ErrorEventArgs } from './Models/EventArgs';
import { PdfOrganizerDialog } from './PdfOrganizer/PdfOrganizerDialog';
import { OpenDocumentInfo } from './SupportApi/types';
import { FloatingSearchBar } from './FloatingSearchBar/FloatingSearchBar';
import { SupportApiType } from './SupportApi/ISupportApiBase';
import { IUndoStorage } from './Undo';
export declare class ReportDocumentMoniker implements DocumentMoniker {
readonly uri: string;
readonly params: ParameterInfo[];
readonly pluginKey = "pdf";
constructor(uri: string, params: ParameterInfo[]);
}
/**
* js-viewer-core plugin module, implements support for PDF document type.
* @ignore exclude from docs
**/
export declare class PdfReportPlugin implements PluginModel.IPluginModule<ReportEvent, ReportAction> {
readonly _viewer: GcPdfViewer;
readonly pluginKey = "pdf";
in17n: i18n;
contextMenu: GcDocumentContextMenu | null;
private readonly _httpClient;
private _searcher;
private _openParameters?;
private _attachmentsPanel?;
private _articlesPanel?;
private _contentsPanel?;
private _sharedDocumentsPanel?;
private _thumbnailsPanel?;
private _searchPanel?;
private _searchPanelRef?;
private _annotationsPanel?;
private _acroFormPanel?;
private _shortcutsConfig;
private _document?;
private _lastViewerState;
private readonly _requiredSupportApi;
private _titleToolbarItem;
private _titleToolbarItemRemoved;
private readonly _errorEvent;
/**
* PDF viewer options.
* */
_options: ViewerOptions;
_documentTitle: string;
_outlineStore: Store<any, any> | null;
_articlesStore: Store<any, any> | null;
_attachmentsStore: Store<any, any> | null;
_annotationsStore?: Store<any, any> | null;
_acroFormStore?: Store<any, any> | null;
_panelsUpdateKey: any;
_pendingBinaryFiles: any;
private _gcpdfdocumentviewer;
private pdfUrl;
_initialViewStateSetFlag: boolean;
_articlesPanelComponent: Articles.View;
_stateStorage: GcPdfViewerStateStorage;
_loadDocViewerPromise: Promise<{}>;
_cancelledInternal: boolean;
private _constructed;
_documentListPanel: PluginModel.PanelHandle;
private _availablePanelsHash;
private _licenseErrorShown;
_pingSupportApiServerTimer: any;
_supportApiAvailable: boolean;
private _supportApiPingStarted;
private _supportApiPingAttempts;
private _requestId;
private _updatingAnnotationFlag;
private _supportApiSuppressError;
private _supportApiSuppressInfo;
private _isViewModeSidebarPinned;
private _updatingPanelFlag;
_sidebarOpened: boolean;
private _lastErrorReport;
private _lastErrorReportTime;
private _documentAssemblyFlag;
private _fillingOfFormFieldsFlag;
_allowPrintFlag: boolean;
_rightSidebar: GcRightSidebar;
private _editableTextBehavior?;
private _supportApi;
private _hasFields?;
private _isAcroFormPresent?;
_isXFAPresent?: boolean;
sharedDocumentsPanel: SharedDocuments;
afterOpenPromiseCapability: {
promise: Promise<any>;
resolve: Function;
reject: Function;
};
private _windowResize?;
private _envInfo;
private _logLevel?;
private _leftSidebar;
docViewerId: string;
private _disposed;
private _dropFileAreaHelper;
_annotationsPanelInstance: Annotations.Annotations | null;
private _serverVersionString;
private _floatingBar;
_floatingSearchBar?: FloatingSearchBar;
private _documentList;
disableFeaturesHash: {
[key in ViewerFeatureName]?: boolean;
};
private _documentKeydownHandler?;
private _documentKeyupHandler?;
private _sideBarElemClickHandler?;
private _shiftDown;
private _titleToolbarItemTextChanged;
private _dataLoader;
private _stampImagesAwaiter;
private _savedChangesVersion;
private _disPrId;
private _documentPointerOver;
private _documentPointerDown;
private _documentPointerUp;
private _cachedViewerPreferences?;
private _undoStorage;
constructor(_viewer: GcPdfViewer, options: Partial<ViewerOptions>, i18n: i18n);
onFileDrop(file: File, insertPoint: GcSelectionPoint): void;
onImageUrlDrop(url: string, insertPoint: GcSelectionPoint, force?: boolean): void;
onZoomChange(zoom: ZoomSettings, prevZoom?: ZoomSettings): ZoomSettings;
/**
*
* @param img
* @param insertPoint Global point relative to browser window (event.pageX, event.pageY). Origin is top-left.
* @param force
*/
onImageDrop(img: HTMLImageElement, insertPoint: GcSelectionPoint, force?: boolean): Promise<void>;
addSignature(imageData: Uint8Array | null, args: {
fileId: string;
pageIndex: number;
rect: number[];
select?: boolean;
subject?: string;
fileName?: string;
convertToContent?: boolean;
}): Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
addStamp(imageData: Uint8Array | null, args: {
fileId: string;
pageIndex: number;
rect: number[];
select?: boolean;
subject?: string;
fileName?: string;
rotate?: number;
convertToContent?: boolean;
}): Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
applyOptions(): void;
private _applyOptionsInternal;
private _fillDisableFeaturesHash;
addViewAreaStyle(cssText: string, styleId?: string): string;
removeViewAreaStyle(id: string): boolean;
get optionalContentConfig(): Promise<OptionalContentConfig>;
get options(): ViewerOptions;
set options(options: ViewerOptions);
get shortcutsConfig(): ShortcutsConfig;
get structureTree(): Promise<any[] | null>;
get dataLoader(): GcPdfViewerDataLoader;
get docViewer(): any;
get supportApi(): ISupportApi | null;
private _initSupportApiIfAny;
get supportApiEnabled(): boolean;
_onSupportApiDisconnected(): void;
/**
* Returns true if the SupportApi version is compatible
* with the current version of GcPdfViewer, otherwise returns false.
* @param version
* @param showErrorMessage Optional. If set to true, GcPdfViewer will show
* an error message if the SupportApi version is NOT compatible. The default is false.
* @param error message severity
*/
isSupportApiCompatible(version: string, showErrorMessage?: boolean, severity?: ErrorSeverity): boolean;
onSupportApiConnectionStateChanged(isConnected: boolean, serverVersion: string): void;
onSupportApiConnected(version: string, isReconnected: boolean): void;
onSupportApiDisconnected(): void;
_onSupportApiConnected(version: string, isReconnected: boolean): void;
dispose(): void;
onWindowResize(): void;
addEvents(): void;
removeEvents(): void;
updatePinButtonTitle(): void;
get keepStampAspectRatio(): boolean;
set keepStampAspectRatio(val: boolean);
loadDocumentList(documentListUrl?: string | DocumentListItem[]): void;
get modificationsState(): ModificationsState;
pushModificationsState(modificationsState: ModificationsState): void;
reportError(params: PluginModel.IErrorParams, allowJsxContent?: boolean): void;
/**
* Show Notification Dialog. Allows JSX content for message.
**/
showNotificationDialog(params: PluginModel.IErrorParams): void;
hideNotificationDialog(): void;
/**
* Indicates whether document is loaded into view.
**/
get hasDocument(): boolean;
setDocumentListPanel(handle: PluginModel.PanelHandle, documentList: DocumentList | null): void;
get documentListPanelId(): string | null;
loadSharedDocuments(): void;
_onError(event: any): void;
private _onMouseModeChange;
private _onAnnotationUpdateCancelled;
private _onAnnotationBoundsChange;
get stampImagesAwaiter(): StampImagesAwaiter;
private _onAnnotationImageLoaded;
/**
* The method changes coordinate system origin for rectangle given by parameter
* bounds and returns converted rectangle value;
* @param pageIndex Page index (Zero based).
* @param bounds bounds array: [x1, y1, x2, y2]
* @param srcOrigin source coordinate system origin
* @param destOrigin destination coordinate system origin
*/
changeBoundsOrigin(pageIndex: number, bounds: number[], srcOrigin: 'TopLeft' | 'BottomLeft', destOrigin: 'TopLeft' | 'BottomLeft', normalize?: boolean): number[];
/**
* Returns PDF page view port information.
* @param pageIndex Page index (Zero based).
* @returns Object containing following fields:
* {
* viewBox: number[], // Original page bounds: [x1, y1, x2, y2].
* // If you want to know original page's width/height, you can get it using viewBox values:
* // var pageWidth = viewBox[2] - viewBox[0];
* // var pageHeight = viewBox[3] - viewBox[1];
* width: number, // Current width of the page in user space (scale and rotation values are applied),
* height: number, // Current height of the page in user space (scale and rotation values are applied)
* scale: number, // Active scale value
* rotation: number, // Active rotation value
* }
*/
getViewPort(pageIndex: number): PageViewport;
private _onRequestShowCustomLayout;
private _onRequestHideCustomLayout;
/**
* Send request answer.
* @param resquestId
*/
answerRequest(answerData: any): void;
private _onFirstArticleBead;
_onLastArticleBead(event: any): void;
_onArticleBeadNavigate(event: any): void;
_onDocumentClosed(): void;
private _onUndoStoreChanged;
ensureSelectedAnnotationElement(pageIndex: number, annotation: AnnotationBase | string, args?: {
skipPropertiesExpand?: boolean;
}): Promise<boolean>;
get hasSelectedAnnotationElement(): boolean;
ensureSelectedAnnotation(): void;
getAnnotationsStateModel(): AnnotationsModel;
private _updateAnnotationAfterEdit;
private _onAnnotationDone;
private _onAnnotationEditStarted;
loadAnnotationResourceFromUrl(annotationId: string, annotationType: AnnotationTypeCode, resourceUrl: string, selectedImageDpi?: number, select?: boolean, imageDataKey?: string | undefined): Promise<void>;
selectResourceFromFile(annotationId: string, annotationType: AnnotationTypeCode, select?: boolean): void;
private onDisposing;
onDocumentOpen(): Promise<void>;
applyPageModePreference(exitFromFullScreen?: boolean): void;
private _resetRestrictionFlags;
private _loadRestrictionFlags;
private _onPageChange;
private _onPagesLoaded;
private _onDocumentLoad;
private _onScaleChange;
get activePanelId(): string | null;
set activePanelId(id: string | null);
pluginReady(): boolean;
/**
* Returns true when editor mode is activated (editor can work with collapsed sidebar).
* @param panelId
*/
private onPanelToggled;
closeSearchPanel(): void;
closeFloatingSearchBar(): void;
onPanelChange: (panelId: string | null) => void;
toggleAnnotationProperties(): void;
freezeAnnotationEditorButton(): void;
freezeFormEditorButton(): void;
toggleFormProperties(): void;
applyToolbarLayout(): void;
toggleSidebar(panelId: string, pin?: boolean): void;
private _ensureNarrowScreenDisabled;
updateSharedDocumentLabel(): void;
updateSecondToolbarPosition(): void;
updateScrollViewRightMargin(): void;
private _onStateChange;
/**
* Change page index for internal doc viewer;
* @param newPageIndex
* @param pageIndexFromLastState
* @returns true if doc title needs update.
*/
setDocViewerPageIndex(newPageIndex: number, pageIndexFromLastState?: number): boolean;
get hasArticles(): boolean;
_updatePanels(state: Model, force?: boolean): void;
getSelectedText(): string;
/**
* Return true if panel is available for current document view.
* @param panelId
*/
isPanelAvailable(panelId: string): boolean;
/**
* Add title toolbar item.
* */
addDocumentTitleTool(): void;
/**
* Outline panel.
**/
addOutlinePanel(): PanelHandle;
scrollMarkedTextIntoView(pageIndex: number, id: string): Promise<void>;
/**
* StructureTree panel.
**/
addStructureTreePanel(): PanelHandle;
/**
* Add optional content panel.
* @example
* ```javascript
* viewer.addOptionalContentPanel();
* ```
**/
addLayersPanel(): PanelHandle;
/**
* Add table extraction panel.
* @example
* ```javascript
* viewer.addTableExtractionPanel();
* ```
**/
addTableExtractionPanel(): PanelHandle;
addSharedDocumentsPanel(): PanelHandle;
/**
* Thumbnails panel.
* */
addThumbnailsPanel(): PanelHandle;
/**
* Search panel.
* */
addSearchPanel(): PanelHandle;
/**
* Gets the search panel handle if the search panel has been added to the user interface.
**/
get searchPanelHandle(): PanelHandle | undefined;
/**
* Gets the search panel component if the search panel has been added to the user interface.
**/
get searchPanel(): Search.SearchPanel | undefined;
/**
* Article threads panel
* */
addArticlesPanel(): PanelHandle;
/**
* Attachments panel
* */
addAttachmentsPanel(): PanelHandle;
get hasReplyTool(): boolean;
get rightSidebar(): GcRightSidebar;
addReplyTool(sidebarState?: GcRightSidebarState): void;
/**
* Annotation editor panel
* */
addAnnotationEditorPanel(visible?: boolean): PanelHandle;
get uniqueId(): string;
/**
* AcroForm editor panel.
*/
addFormEditorPanel(visible?: boolean): PanelHandle;
/**
* Add annotation to the active document.
* @param pageIndex
* @param annotation
*/
addAnnotation(pageIndex: number, annotation: AnnotationBase, args?: {
skipPageRefresh?: boolean;
}): Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
/**
* Update annotation.
* @param pageIndex
* @param annotation
* @param args
*/
updateAnnotation(pageIndex: number, annotation: AnnotationBase, args?: {
skipPageRefresh?: boolean;
prevPageIndex?: number;
changedPageIndex?: number;
propertyName?: string;
}): Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
/**
* Validates the given annotation object based on its type and properties.
*
* This function performs various checks to ensure that the annotation is valid.
* @ignore Exclude from documentation.
*
* @param {Object} annotation - The annotation object to validate.
* @param {boolean} [throwException=true] - Whether to throw an exception when validation fails.
* @returns {boolean} - Returns `true` if the annotation passes all validation checks, `false` otherwise.
* @throws {Error} - Throws an error if a validation rule fails and `throwException` is true.
*/
validateAnnotation(annotation: AnnotationBase, throwException?: boolean): boolean;
/**
* Update annotations.
* @param pageIndex
* @param annotations
* @param args
*/
updateAnnotations(pageIndex: number, annotations: AnnotationBase | AnnotationBase[], args?: {
skipPageRefresh?: boolean;
}): Promise<{
pageIndex: number;
annotations: AnnotationBase[];
}>;
updateGroupFieldValue(fieldName: string, newValue: string, args?: {
skipPageRefresh?: boolean;
propertyName?: string;
}): Promise<boolean>;
/**
* Remove annotation from document.
* @param pageIndex Page index where annotation is located.
* @param annotation Annotation id or annotation object itself.
*/
removeAnnotation(pageIndex: number, annotation: string | AnnotationBase, args?: {
skipPageRefresh?: boolean;
}): Promise<boolean>;
findAnnotation(findString: string | number, findParams?: {
findField?: 'id' | 'title' | 'contents' | 'fieldName' | string;
pageNumberConstraint?: number;
findAll?: boolean;
}): Promise<{
pageNumber: number;
annotation: AnnotationBase;
}[]>;
getAttachments(): Promise<{
pageNumber: number;
annotation: AnnotationBase;
}[]>;
/**
* Select annotation for editing.
* @param pageIndex Page index (Zero-based) or annotation id.
* @param annotation Annotation id or annotation object itself.
*/
selectAnnotation(pageIndex: number | string, annotation?: AnnotationBase | string): Promise<boolean>;
setExpandedEditorState(expandedPageIndex: number, selectedAnnotationId: string, expandedAnnotationIds: any): void;
/**
* Reset annotation selection.
* */
unselectAnnotation(): any;
/**
* Scroll annotation into view.
* @param pageIndex
* @param annotation
*/
scrollAnnotationIntoView(pageIndexOrId: number | string, annotationOrScrollOptions?: AnnotationBase | string | ScrollBehavior | ScrollPageIntoViewOptions, scrollOptions?: ScrollBehavior | ScrollPageIntoViewOptions): Promise<void>;
/**
* Scroll annotation properties into view.
* @param pageIndex
* @param annotation
*/
scrollAnnotationPropertiesIntoView(pageIndex: number, annotation: AnnotationBase | string): void;
/**
* Repaint pages. This method also redraws the page annotations.
* @param indicesToRepaint If specified, page indices to be redrawn, otherwise, this method redraws visible pages.
**/
repaint(indicesToRepaint?: number[], options?: {
repaintOnVisible?: boolean;
}): void;
repaintTextLayer(indicesToRepaint?: number[]): void;
getAnnotationPageIndex(annotation: string | AnnotationBase): number | null;
getAnnotationFromState(annotation: string | AnnotationBase): AnnotationBase | null;
logError(method: string, message: string): void;
logDebug(method: string, message: string): void;
_onAddAnnotationRequest: (pageIndex: number, node: AnnotationBase) => Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
_onUpdateAnnotationRequest: (pageIndex: number, node: AnnotationBase, skipExpand?: boolean, args?: any) => Promise<{
pageIndex: number;
annotation: AnnotationBase;
}>;
_onUpdateAnnotationsRequest: (pageIndex: number, nodes: AnnotationBase[]) => Promise<{
pageIndex: number;
annotations: AnnotationBase[];
}>;
_onRemoveAnnotationRequest: (pageIndex: number, id: string) => Promise<boolean>;
_onAnnotationNavigate: (pageIndex: number, node: AnnotationBase, params?: {
preserveExpanded?: boolean;
preserveFocused?: boolean;
toggle?: boolean;
}) => Promise<void>;
_updateAttachmentsInternal(force?: boolean): void;
resolveLinkNamedDestination(annotationOrId: string | AnnotationBase): void;
/**
* Refresh expanded annotation's property list.
* @param annotationId Optional. When specified the property list will be updated only for annotation with specified id.
*/
refreshPropertyList(annotationId?: string): void;
dispatchCommentsStoreState(): void;
/**
* Returns true on expand.
* @param pageIndex
* @param annotation
* @param allowMultiple
*/
private _dispatchAnnotationsState;
_onAnnotationNavigatePage: (pageIndex: number) => Promise<void>;
loadAndScrollPageIntoView(pageIndex: number, destArray?: any[], scrollIntoViewOptions?: ScrollPageIntoViewOptions | boolean): Promise<boolean>;
get pageIndex(): number;
/**
* Gets the file data. Available when keepFileData option is set to true.
* */
get fileData(): Uint8Array | null;
renderPage(page: PluginModel.IPageData): PluginModel.PageView;
renderHighlightPage(page: PluginModel.IPageData, results: SearchFeature.SearchResult[]): PluginModel.PageView;
/**
* Fires when ESCAPE key pressed.
* */
onEscapePressed(): void;
onOpenDocument(document: PluginModel.IDocument | null): void;
loadDocumentTitle(): Promise<void>;
onOpenDocumentView(view: PluginModel.IDocumentView): void;
resolveAction(_: any, event: any): PluginModel.ViewerAction | ReportAction | null;
processAction(context: PluginModel.ActionContext<ReportEvent>, action: ReportAction): boolean;
/**
* Gets security information for the current document.
**/
getDocumentSecurity(): Promise<DocumentSecuritySummary>;
/**
* Gets meta data information for the current document.
**/
getDocumentInformation(): Promise<DocumentInformation>;
get fileUrl(): string;
get fileName(): string;
/**
* Available only when document is opened locally or when
* file name is passed to newDocument method.
* */
get localFileName(): string;
private _formatLinkP;
private _formatLinkLi;
/**
* Returns the type of the SupportApi implementation.
*/
get supportApiType(): SupportApiType | undefined;
/**
* Shows about dialog.
* */
showAbout(): void;
processEvent(context: PluginModel.ActionContext<ReportEvent>, event: ReportEvent, direction: PluginModel.TimeDirection): void;
/**
* Show the file open dialog where the user can select the PDF file.
* */
openLocalFile(): void;
rotate(value: any): void;
beep(): void;
get scrollViewElement(): HTMLDivElement;
get hostElement(): HTMLElement;
goBack(): void;
goForward(): void;
cleanupDocument(): Promise<void>;
/**
* Show animated highlight for a specific annotation and then hide it with animation.
* @param {string | AnnotationBase} annotationId - The ID or annotation object for which to show the highlight.
* @param {number} [animationDelay=2000] - The delay (in milliseconds) before hiding the animation.
* Minimum value is 1000 milliseconds (1 second).
* @param {string} - Optional. The color in hex format for the highlight.
*/
showAnnotationFocusOutline(annotationId: any, animationDelay?: number, color?: string): void;
dispatchCommentsState(state?: ReplyToolModel): void;
openDocument: (moniker: ReportDocumentMoniker) => Promise<PluginModel.IDocument>;
endUpdate(): void;
startSupportApiPingIfNeeded(): void;
_ensureInitialViewState(): void;
onBeforeOpenFile(file: any, openParameters?: OpenParameters): {
file: string;
promise: Promise<any>;
openParameters?: OpenParameters;
cancel: boolean;
};
open(file: any, openParameters?: OpenParameters): void;
print(): void;
close(): Promise<void>;
save(fileName?: string, saveSettings?: SaveSettings): Promise<boolean>;
submitForm(submitUrl: string, submitForm?: true | SubmitFormOptions): Promise<void>;
resetForm(): void;
getSubmitTransportForm(submitUrl: any, submitForm?: true | {
fields: string[];
refs: string[];
include: boolean;
includeNoValueFields: boolean;
exportFormat: boolean;
getMethod: boolean;
submitCoordinates: boolean;
xFDF: boolean;
submitPDF: boolean;
canonicalFormat: boolean;
}): HTMLFormElement | null;
get annotationStorage(): any;
validateForm(validator?: (fieldValue: string | string[], field: WidgetAnnotation) => boolean | string, silent?: boolean, ignoreValidationAttrs?: boolean): string | boolean;
download(fileName?: string): void;
/**
* Scroll page into view.
* @param params , parameters:
* pageNumber - page number
* destArray - destination information:
* destArray[1].name- view Destination Fit type
*/
scrollPageIntoView(params: {
pageNumber: number;
destArray?: any[];
allowNegativeOffset?: boolean;
}): void;
/**
* Scroll article bead into view.
* @param articleBead
*/
scrollBeadIntoView(articleBead: ArticleBead): void;
isPageVisible(pageNumber: number): boolean;
language: string;
get rotation(): number;
set rotation(val: number);
currentPageNumber: number;
updateVisiblePages(): void;
getVisiblePagesInfo(): IGcVisiblePagesInfo;
loadingThemeFlag: boolean;
get hostParentContainer(): HTMLElement;
/**
* Set active viewer theme.
* @param theme theme name, specified in themes option.
*/
setTheme(theme?: string): void;
raiseStateChanged(): void;
get owner(): GcPdfViewer;
get pdfjsLib(): any;
get pdfDocument(): any;
getViewerPreferences(): Promise<ViewerPreferences>;
get openAction(): Promise<OpenAction | null>;
get logLevel(): LogLevel;
set logLevel(logLvel: LogLevel);
/**
* Command-based undo storage implementation.
* @ignore exclude from documentation.
**/
get undoStorage(): IUndoStorage;
/**
* The current zoom percentage level.
**/
set zoomValue(val: number);
/**
* The current zoom percentage level.
**/
get zoomValue(): number;
/**
* Gets a value indicating whether the pdf viewer can undo document changes.
* */
get hasUndoChanges(): boolean;
/**
* Gets a value indicating whether the pdf viewer can redo document changes.
* */
get hasRedoChanges(): boolean;
/**
* Gets current undo index.
* */
get undoIndex(): number;
/**
* Gets total undo count.
* */
get undoCount(): number;
get isDocumentShared(): boolean;
/**
* Gets all document annotations.
**/
get annotations(): Promise<{
pageIndex: number;
annotations: AnnotationBase[];
}[]>;
/**
* Returns PDF viewer version.
* */
get version(): string;
/**
* Gets or sets active edit mode.
* */
get editMode(): EditMode;
set editMode(mode: EditMode);
activateReplaceTextFeature(): Promise<void>;
activateEditMode(mode: EditMode, args?: {
editMode: EditMode;
imageUrl: string;
imageDpi: number;
w: number;
h: number;
imageDataKey?: string;
afterAdd?: (result: {
pageIndex: number;
annotation: AnnotationBase;
}) => void;
} | null): void;
set editModeArgs(args: {
editMode: EditMode;
imageUrl: string;
imageDpi: number;
w: number;
h: number;
imageDataKey?: string;
afterAdd?: (result: {
pageIndex: number;
annotation: AnnotationBase;
}) => void;
} | null);
get editModeArgs(): {
editMode: EditMode;
imageUrl: string;
imageDpi: number;
w: number;
h: number;
imageDataKey?: string;
afterAdd?: (result: {
pageIndex: number;
annotation: AnnotationBase;
}) => void;
} | null;
/**
* Gets or sets the layout mode (Viewer, AnnotationEditor or FormEditor). Default layout mode is Viewer.
* */
get layoutMode(): LayoutMode;
set layoutMode(mode: LayoutMode);
get requiredSupportApiVersion(): string;
get supportApiVersion(): string;
get gcPdfVersion(): string;
showSecondToolbar(toolbarKey: string): Promise<void>;
_activatedEditorMode?: "SecondBar" | "FormEditor" | "AnnotationEdtor" | "Any" | "";
get isAnyEditorMode(): boolean;
get activatedEditorMode(): "SecondBar" | "FormEditor" | "AnnotationEdtor" | "Any" | "" | undefined;
get isInEditorMode(): boolean;
activateEditorMode(caller: "SecondBar" | "FormEditor" | "AnnotationEdtor"): void;
deactivateEditorMode(caller: "SecondBar" | "ViewerLayout"): void;
redrawTouchedAnnotations(): Promise<void>;
private _ensureLayoutMode;
/**
* Gets if annotations layer is hidden.
* */
get hideAnnotations(): boolean;
/**
* Sets if annotations layer should be hidden.
* */
set hideAnnotations(hide: boolean);
/**
* Returns true if document has been changed by user.
**/
get hasChanges(): boolean;
/**
* Gets the revision version of the active document.
* @ignore exclude from docs.
**/
get changesVersion(): number;
/**
* Error event.
* */
get onError(): EventFan<ErrorEventArgs>;
get onBeforeOpen(): EventFan<BeforeOpenEventArgs>;
get onAfterOpen(): EventFan<AfterOpenEventArgs>;
get onThemeChanged(): EventFan<AfterOpenEventArgs>;
activatePredefinedStampEditMode(args: {
selectedImageUrl: string | undefined;
selectedImageDpi: number;
width?: number;
height?: number;
imageDataKey?: string;
afterAdd?: (result: {
pageIndex: number;
annotation: AnnotationBase;
}) => void;
}): void;
get isActivateEditModeOnMouseMoveAllowed(): boolean;
commitChanges(): boolean;
cancelChanges(): void;
cancelInlineTextEdit(): string;
clearStampsCache(): void;
setPageTabs(pageIndex: number, tabs: "S" | "R" | "C" | "A" | "W" | undefined): void;
getPageTabs(pageIndex: number): "S" | "R" | "C" | "A" | "W" | undefined;
/**
* Set the absolute page rotation.
* Requires SupportApi.
* @param pageIndex
* @param rotation
*/
setPageRotation(pageIndex: number, rotation: number, viewRotationIncluded?: boolean): Promise<boolean>;
/**
* Get the absolute page rotation.
* @param pageIndex
*/
getPageRotation(pageIndex: number, includeViewRotation?: boolean): number;
setPageSize(pageIndex: number, size: {
width: number;
height: number;
}): Promise<boolean>;
/**
* @deprecated do not use this method for a new logic.
* Instead, use the convertToViewportPoint, convertToViewportRectangle, convertToPdfPoint methods from PageViewport instance.
* See getViewPort(pageIndex).
* @ignore exclude from docs
**/
toViewPortPoint(p: GcSelectionPoint): GcSelectionPoint;
/**
* Add sticky note to the document.
* @param position page relative point. Origin is top/left.
* Note, pageIndex must be specified, e.g. viewer.addStickyNote({x: 50,y: 50, pageIndex: 0}).
*/
addStickyNote(position: GcSelectionPoint, skipEdit?: boolean): void;
private ensurePopupWrapper;
showInlineTextEditor(textElement: HTMLElement, annotationElement: HTMLElement, pageIndex: number, annotation: AnnotationBase, propertyKey: string, finishCallback?: Function): void;
hideInlineTextEditor(): void;
openSharedDocument(sharedDocumentId: string): Promise<OpenDocumentInfo | null>;
onSharedAccessModeChanged(newSharedAccessMode: SharedAccessMode): void;
/**
* Clone annotation or field given by parameter annotation.
* @param annotation Annotation/field to clone.
*/
cloneAnnotation(annotation: AnnotationBase): AnnotationBase;
get hasCopyData(): boolean;
execCutAction(buffer?: CopyBufferData): Promise<boolean>;
execCopyAction(buffer?: CopyBufferData): Promise<boolean>;
execPasteAction(position?: GcSelectionPoint): Promise<boolean>;
execDeleteAction(buffer?: CopyBufferData): Promise<boolean>;
/**
*
* @param pageIndex
* @param annotation
* @param state
* @param userName
*/
setAnnotationState(pageIndex: number, referenceAnnotation: TextAnnotation, state: AnnotationMarkedStateType | AnnotationReviewStateType, referenceType: 'R' | 'Group', userName?: string): Promise<boolean>;
resetChanges(): Promise<void>;
reload(keepUndoState?: boolean): Promise<void>;
/**
* Undo document changes.
* */
undoChanges(): Promise<void>;
/**
* Redo document changes.
* */
redoChanges(): Promise<void>;
/**
* Create and open new blank document.
* @param params
*/
newDocument(params?: {
fileName?: string;
confirm?: boolean;
}): Promise<LoadResult | null>;
/**
* Adds a blank page to the document.
* @param params
*/
newPage(params?: {
width?: number;
height?: number;
pageIndex?: number;
}): Promise<void>;
/**
* Delete page.
* @param params
*/
deletePage(pageIndex?: number): Promise<void>;
private _ensureZoomFactorBounds;
private _leftSidebarWidths;
private _leftSideBarResizedHandler;
private _setInitialLeftSidebarWidth;
private _freezePanelButtonActiveState;
private _unfreezePanelButtonActiveState;
private _updateEditorToolbarLayout;
private _createAnnotationsStore;
private _loadDocViewer;
get searcher(): GcPdfSearcher;
useFloatingSearchBar(): void;
get floatingSearchBar(): Promise<FloatingSearchBar>;
get floatingBar(): Promise<FloatingBar>;
private _onDocViewerReady;
private _showProLicenseError;
private _showLicenseError;
//@ts-ignore
_convertMsgToContent(msg: string): JSX.Element[];
/**
* Gets the auto-scroll helper instance.
*
* @returns {IAutoScrollHelper | undefined} The auto-scroll helper if available, otherwise `undefined`.
*/
get autoScrollHelper(): IAutoScrollHelper | undefined;
get sidebarPinned(): boolean;
get leftSidebar(): LeftSidebar;
execSidebarPanel(methodName: 'pin' | 'open' | 'unpin' | 'close' | 'toggle' | 'collapse' | 'expand', panelId?: string): void;
beginPanelUpdate(doNotLock?: boolean): boolean;
endPanelUpdate(): void;
_ensureEditorCloseIcon(): void;
private _showEditorPanel;
/**
* Unique document identifier.
* */
get fingerprint(): string;
private _editorRestrictionsMessageShownKey?;
private _showEditorRestrictionsIfAny;
private _showViewerLayout;
private _onAnnotationsLoaded;
get currentUserName(): string;
set currentUserName(userName: string);
updateTextCommentsState(annotationsData: {
pageIndex: number;
annotations: AnnotationBase[];
}[]): void;
/**
* Used to append FileAttachment annotations to the Attachments panel.
* @private
*/
private _appendAttachment;
private onArticleNavigate;
private onAttachmentNavigate;
private onHasFormChanged;
private onPdfAttachmentNavigate;
private onNavigate;
private _updateDocumentTitle;
private _ensureDocTitleClass;
get documentOpenedOnServer(): boolean;
set documentOpenedOnServer(val: boolean);
/**
* Indicates whether opened document can be edited using SupportApi.
* */
get canEditDocument(): boolean;
/**
* Indicates whether opened document can be printed.
* */
get canPrintDocument(): boolean;
/**
* Indicates whether "Add Sticky Note" context menu item is shown.
* */
get canAddStickyNote(): boolean;
/**
* Gets a value indicating whether the active document has any fillable form fields.
* @example
* ```javascript
* if(viewer.hasForm) {
* viewer.showFormFiller();
* }
* ```
* */
get hasForm(): boolean;
/**
* Displays 'Form filler' dialog.
* @example
* ```javascript
* if(viewer.hasForm) {
* viewer.showFormFiller();
* }
* ```
* */
showFormFiller(): void;
/**
* Displays the 'Add Signature' dialog.
* @example
* ```javascript
* viewer.showSignTool();
* ```
* @param preferredSettings Optional. These settings will take priority over signSettings option.
**/
showSignTool(preferredSettings?: SignToolSettings): void;
_additionalLocalizationMessages(): void;
/**
* Checks whether the annotation is locked for editing.
**/
checkAnnotationLocked(annotationToCheck: AnnotationBase, editType?: "Any" | "EditProperty" | "Delete" | "EditContents", showErrorMessageAndRefresh?: boolean): boolean;
showAnnotationLocked(node: AnnotationBase): void;
showEditingToolsDisabledMessage(details?: string, severity?: "error" | "warn" | "info" | "debug"): void;
showMessage(message: string, details?: string, severity?: "error" | "warn" | "info" | "debug", allowJsxContent?: boolean, autoHideTimeout?: number): void;
private _pingSupportApiServer;
private _convertPropertyValues;
get propertiesDialog(): PropertiesDialog;
confirmationDialog: ConfirmationDialog;
shareDialog: ShareDialog;
formFillerDialog: FormFillerDialog;
inputPasswordDialog: GcPdfPasswordDialog;
printProgressDialog: GcPdfPrintProgress;
progressDialog: ProgressDialog;
signToolDialog: SignToolDialog;
contextMenuProvider: ContextMenuProvider;
fPropertiesDialog: PropertiesDialog;
pdfOrganizerDialog: PdfOrganizerDialog;
renderDialogRoots(viewer: GcPdfViewer): void;
disposeDialogRoots(): void;
}
export default PdfReportPlugin;