@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
139 lines (138 loc) • 6.37 kB
TypeScript
import { ProgressDialogSink } from "../../Dialogs/Types";
import { SaveSettings, StampCategory, ViewerFeatureName } from "../../Models/ViewerTypes";
import { ClientTableExtractOptions } from "../../TableDataExtraction/types";
import { ViewerOptions } from "../../ViewerOptions";
import { ISupportApiBase, SupportApiType } from "../ISupportApiBase";
import { OpenDocumentInfo, DocumentModification, TableDefClientModel } from "../types";
import { IWasmModule } from "./IWasmModule";
/**
* Implementation of the SupportApi interface using WebAssembly (Wasm) technology.
* This class provides the functionality to interact with Support API services through WebAssembly.
*
* @implements {ISupportApiBase}
*/
export declare abstract class WasmSupportApiBase implements ISupportApiBase {
clientId: string;
docInfo: OpenDocumentInfo;
documentId: string;
isDocumentShared: boolean;
private _isConnected;
isOpened: boolean;
viewerOptions: ViewerOptions;
wasmModule: IWasmModule;
viewer: any;
private _connectPromiseCapability?;
constructor(args?: any);
get isConnected(): boolean;
set isConnected(isConnected: boolean);
/**
* Returns the type of the SupportApi implementation.
*/
get supportApiType(): SupportApiType | undefined;
/**
* Applies the specified viewer options.
* @param {any} options - The new viewer options.
* @returns {void}
*/
applyOptions(options: any): void;
/**
* Sets the viewer instance for the SupportApi client. This method is called during the initialization of the viewer.
* It passes a reference to the viewer that utilizes an instance of the SupportApi client of this class.
*
* @param viewer The viewer instance that uses the SupportApi client instance of this class.
*/
setViewer(viewer: any): void;
/**
* Indicates whether the viewer has permission to edit the specified annotation.
* @param {AnnotationBase | null} annotation - The annotation to check for edit permissions.
* @returns {boolean} True if the viewer can edit the annotation; otherwise, false.
*/
canEditAnnotation(annotation?: any | null | undefined): boolean;
/**
* Ensure that the document loader exists on the server.
* Document Loader may not be present after a server restart.
* @returns A Promise that resolves to a boolean indicating whether the document loader is available.
*/
checkDocumentLoader(): Promise<boolean>;
/**
* Closes the document loader and releases resources on the server.
* @returns A promise that resolves to a boolean indicating the success of the operation.
*/
closeDocumentLoader(): Promise<boolean>;
/**
* Closes previously opened document and free client and server resources.
*/
close(): Promise<string>;
/**
* Attempt to connect the SupportApi client to the server.
* @param lazy Optional. Set to true if you don't want to recheck the connection if the server has already been checked. Default is false.
* @returns A Promise that resolves to a boolean indicating whether the connection attempt was successful.
*/
connect(lazy?: boolean | undefined): Promise<boolean>;
/**
* Dispose SupportApi client.
*/
dispose(): void;
/**
* Returns an array of features that are disabled or unsupported by the SupportApi instance.
*
* @returns {ViewerFeatureName[] | null} - An array of feature names that are disabled/unsupported,
* or null if the information is unavailable.
*/
getDisabledFeatures(): ViewerFeatureName[] | null;
/**
* Gets the URL which can be used to download modified document from SupportApi service.
* @param filename Default value for filename property in HTTP header.
*/
getDownloadUrl(filename: string, format: "PDF" | "PNG" | "SVG" | undefined, correlationId: string): Promise<string>;
/**
* Gets the URL which can be used to download modified document from SupportApi service.
* @param filename Default value for filename property in HTTP header.
*/
getDownloadUnmodifiedUrl(filename: string): string;
/**
* Upload files.
* @param fileIds File identifiers to upload.
* @param sink Progress sink for tracking the upload progress.
* @returns A Promise that resolves to a boolean indicating the success of the upload.
*/
uploadFiles(fileIds: string[], sink?: ProgressDialogSink): Promise<boolean>;
getLastError(): Promise<string>;
/**
* Get predefined stamp images info.
* @returns A Promise that resolves to an array of StampCategory objects.
*/
getStampCategories(): Promise<StampCategory[]>;
/**
* Get the stamp image URL.
* @param categoryId The ID of the stamp category.
* @param imageName The name of the stamp image.
* @param enableCache Flag indicating whether to enable caching for the stamp image.
* @returns The URL for the stamp image.
*/
getStampImageUrl(categoryId: string, imageName: string, enableCache: boolean): string;
modify(documentModification: DocumentModification, correlationId: string): Promise<string>;
openBinary(data: Uint8Array): Promise<void>;
serverVersion(): Promise<string>;
setOptions(saveSettings: SaveSettings | undefined, correlationId: string): Promise<string>;
verifySignature(fieldName: string): Promise<boolean>;
extractTableData(extractSettings?: ClientTableExtractOptions): Promise<TableDefClientModel[] | null>;
protected abstract loadWasmModule(): Promise<IWasmModule>;
initWasmModule(): Promise<IWasmModule>;
private _connectInternal;
/**
* Constructs and returns the resources URL by appending "resources/" to the base URL.
*
* @private
* @returns {string} The complete resources URL.
*/
private _getResourcesUrl;
/**
* Finds and returns the base URL for the viewer. If the base URL is not defined,
* it retrieves the base script URL. Ensures the base URL ends with a slash.
*
* @private
* @returns {string} The base URL with a trailing slash.
*/
private _findBaseUrl;
}