@@ -30,22 +30,25 @@ declare class BaseBrowseViewer implements IBrowseViewer {
3030 show ( ) : void ;
3131 hide ( ) : void ;
3232 getSelectedPageIndices ( ) : number [ ] ;
33- /**
34- * Select all pages of the activated document.
35- * @returns A boolean value represent whether the operation is successful.
36- */
3733 selectAllPages ( ) : string [ ] ;
38- /**
39- * Select the pages according the index of pages in the activated document.
40- * @param indices - The index of pages to be selected.
41- * @returns A boolean value represent whether the operation is successful.
42- */
4334 selectPages ( indices : number [ ] ) : string [ ] ;
4435 setRowAndColumn ( row : number , column : number ) : boolean ;
4536 on < K extends keyof BrowseViewerEventMap > ( eventName : K , listener : ( event : BrowseViewerEventMap [ K ] ) => any ) : void ;
4637 off < K extends keyof BrowseViewerEventMap > ( eventName : K , listener ?: ( event : BrowseViewerEventMap [ K ] ) => any ) : void ;
4738 destroy ( ) : void ;
4839}
40+ declare class Core {
41+ #private;
42+ get versionInfo ( ) : DDVVersionInfo ;
43+ set engineResourcePath ( path : string ) ;
44+ get engineResourcePath ( ) : string ;
45+ set license ( license : string ) ;
46+ get license ( ) : string ;
47+ set deviceFriendlyName ( name : string ) ;
48+ get deviceFriendlyName ( ) : string ;
49+ loadWasm ( ) : Promise < void > ;
50+ init ( ) : Promise < ConfigResult > ;
51+ }
4952declare class DocumentDetect implements IDocumentDetect {
5053 #private;
5154 constructor ( ) ;
@@ -66,7 +69,7 @@ declare class DocumentManager {
6669 * @param options - The configuration used to create a document.
6770 * @returns An empty document object.
6871 */
69- createDocument ( options ?: CreateDocumentOptions ) : IDocument | null ;
72+ createDocument ( options ?: CreateDocumentOptions ) : IDocument ;
7073 /**
7174 * Get the document with the document uid.
7275 * @param docUid - The uid of the target document.
@@ -83,7 +86,7 @@ declare class DocumentManager {
8386 deleteAllDocuments ( ) : boolean ;
8487 copyPagesToDocument ( sourceDocUid : string , targetDocUid : string , transferOptions ?: TransferOptions ) : boolean ;
8588 movePagesToDocument ( sourceDocUid : string , targetDocUid : string , transferOptions ?: TransferOptions ) : boolean ;
86- mergeDocuments ( docUids : string [ ] , options ?: MergeDocumentsOptions ) : IDocument | null ;
89+ mergeDocuments ( docUids : string [ ] , options ?: MergeDocumentsOptions ) : IDocument ;
8790 on < K extends keyof DocumentManagerEventMap > ( eventName : K , listener : ( event : DocumentManagerEventMap [ K ] ) => any ) : void ;
8891 off < K extends keyof DocumentManagerEventMap > ( eventName : K , listener ?: ( event : DocumentManagerEventMap [ K ] ) => any ) : void ;
8992}
@@ -149,7 +152,7 @@ declare class ImageFilterHandler implements IImageFilter {
149152 applyFilter ( type : string ) : Promise < ArrayBuffer > ;
150153 queryParams ( type : string ) : any ;
151154 get defaultFilterType ( ) : string ;
152- querySupported ( ) : ImageFilterMethod [ ] ;
155+ querySupported ( ) : ImageFilterItem [ ] ;
153156 destroy ( ) : void ;
154157}
155158declare class ImageIOWasmEnv {
@@ -166,10 +169,10 @@ declare class ImageIOWasmEnv {
166169 static getLicenseInfo ( license : any , isLts : boolean , uuid : string ) : Promise < any > ;
167170 private static Init ;
168171 static isResourceDirValid ( ) : Promise < boolean > ;
169- static loadPdfReader ( license : any , isLts : boolean , uuid : string ) : Promise < boolean > ;
170- static loadMain ( license : any , isLts : boolean , uuid : string ) : Promise < boolean > ;
172+ static loadPdfReader ( license : any , isLts : boolean , uuid : string ) : Promise < any > ;
173+ static loadMain ( license : any , isLts : boolean , uuid : string ) : Promise < any > ;
171174 static load ( license : any , isLts : boolean , uuid : string ) : Promise < void > ;
172- static preloadModule ( name : WasmModuleName ) : Promise < void > ;
175+ static preloadModule ( name : WasmModuleName ) : Promise < any > ;
173176 static unloadMainWorker ( ) : void ;
174177 static unloadPdfReaderWorker ( ) : void ;
175178 static unloadDocumentDetectorWorker ( ) : void ;
@@ -182,7 +185,8 @@ declare const Version: string;
182185declare enum WorkerName {
183186 core = "ddv-core" ,
184187 reader = "ddv-reader" ,
185- detector = "ddv-detector"
188+ detector = "ddv-detector" ,
189+ loader = "ddv-loader"
186190}
187191export declare class BrowseViewer extends BaseBrowseViewer {
188192 constructor ( options : BrowseViewerConstructorOptions ) ;
@@ -455,6 +459,8 @@ export declare class PerspectiveViewer {
455459export declare const DDV : {
456460 /** The document manager object */
457461 documentManager : DocumentManager ;
462+ /** The configuration object */
463+ Core : Core ;
458464 Elements : typeof Elements ;
459465 DocumentDetect : typeof DocumentDetect ;
460466 ImageFilter : typeof ImageFilterHandler ;
@@ -463,15 +469,19 @@ export declare const DDV: {
463469 CustomViewer : typeof CustomViewer ;
464470 EditViewer : typeof EditViewer ;
465471 PerspectiveViewer : typeof PerspectiveViewer ;
466- readonly versionInfo : DDVVersionInfo ;
467472 readonly lastError : DDVError ;
468473 Experiments : {
469474 get ( name : string , params ?: any ) : any ;
470475 set ( name : string , value : any ) : any ;
471476 } ;
472- setConfig ( config : Configuration ) : Promise < ConfigResult > ;
473477 getDefaultUiConfig ( viewerType : ViewerType ) : UiConfig | null ;
474478 setProcessingHandler < K extends keyof ProcessingHandlerMap > ( type : K , handler : ProcessingHandlerMap [ K ] ) : void ;
479+ /**
480+ * Set a filter parser to the DDV system.
481+ * @param mine - The MIME type of file.
482+ * @param parserClass - The constructor of the file parser.
483+ */
484+ setFileParser ( mine : string , parserClass : FileParserConstructor ) : void ;
475485 unload ( ) : void ;
476486 clearLastError ( ) : void ;
477487 on < K_1 extends keyof DDVEventMap > ( eventName : K_1 , listener : ( event : DDVEventMap [ K_1 ] ) => any ) : void ;
@@ -600,29 +610,6 @@ export interface BrowseViewerConfig {
600610 scrollToLatest ?: boolean ;
601611 enableDragPage ?: boolean ;
602612}
603- export interface BrowseViewerConfig {
604- canvasStyle ?: CanvasStyle ;
605- currentPageStyle ?: BaseStyle ;
606- pageStyle ?: BaseStyle ;
607- selectedPageStyle ?: BaseStyle ;
608- hoveredPageStyle ?: BaseStyle ;
609- placeholderStyle ?: BaseStyle ;
610- pageNumberStyle ?: PageNumberStyle ;
611- checkboxStyle ?: CheckboxStyle ;
612- rows ?: number ;
613- columns ?: number ;
614- scrollDirection ?: "horizontal" | "vertical" ;
615- multiselectMode ?: boolean ;
616- scrollToLatest ?: boolean ;
617- enableDragPage ?: boolean ;
618- }
619- export interface BrowseViewerConstructorOptions {
620- container ?: string | HTMLElement ;
621- viewerConfig ?: BrowseViewerConfig ;
622- uiConfig ?: UiConfig ;
623- /** The uid of the controller/viewer to be synced */
624- groupUid ?: string ;
625- }
626613export interface BrowseViewerConstructorOptions {
627614 container ?: string | HTMLElement ;
628615 viewerConfig ?: BrowseViewerConfig ;
@@ -700,12 +687,7 @@ export interface CheckboxStyle {
700687}
701688export interface ConfigResult {
702689 licenseInfo : string ;
703- deviceId ?: string ;
704- }
705- export interface Configuration {
706- license : string ;
707- deviceFriendlyName ?: string ;
708- engineResourcePath : string ;
690+ deviceUuid ?: string ;
709691}
710692export interface CreateDocumentOptions {
711693 name ?: string ;
@@ -854,6 +836,9 @@ export interface ExtraPageData {
854836 filter ?: string ;
855837 perspectiveQuad ?: Quad ;
856838}
839+ export interface FileParserConstructor {
840+ new ( ) : IFileParser ;
841+ }
857842export interface FitModeChangedEvent {
858843 readonly oldFitMode : FitModeEnum ;
859844 readonly newFitMode : FitModeEnum ;
@@ -888,7 +873,8 @@ export interface IDocument {
888873 loadSource ( fileData : Blob | Blob [ ] , index ?: number ) : Promise < string [ ] > ;
889874 loadSource ( sources : Source | Source [ ] , index ?: number ) : Promise < string [ ] > ;
890875 getPageData ( pageUid : string ) : Promise < PageData > ;
891- updatePage ( pageUid : string , data : Blob ) : Promise < boolean > ;
876+ insertBlankPage ( pageWidth : number , pageHeight : number , insertBeforeIndex ?: number ) : string ;
877+ updatePage ( pageUid : string , data : Blob , options ?: UpdatePageOptions ) : Promise < boolean > ;
892878 setPageCustomData ( pageUid : string , data : any ) : Promise < boolean > ;
893879 getPageCustomData ( pageUid : string ) : Promise < any > ;
894880 deletePages ( indices : number [ ] ) : boolean ;
@@ -908,8 +894,17 @@ export interface IDocumentDetect {
908894 detect ( image : VImageData , config ?: DocumentDetectConfig ) : Promise < DocumentDetectResult > ;
909895 destroy ( ) : void ;
910896}
897+ export interface IFileParser {
898+ once : boolean ;
899+ getPageCount ( file : Blob , options ?: any ) : Promise < number > ;
900+ parse ( file : Blob , options ?: any ) : Promise < ParsedPage [ ] > ;
901+ parse ( file : Blob , indices : number [ ] , options ?: any ) : Promise < ParsedPage [ ] > ;
902+ getPage ( index : number , options ?: any ) : Promise < ParsedPage > ;
903+ cancelGetPage ( index : number ) : void ;
904+ destroy ( ) : void ;
905+ }
911906export interface IImageFilter {
912- querySupported ( ) : ImageFilterMethod [ ] ;
907+ querySupported ( ) : ImageFilterItem [ ] ;
913908 get defaultFilterType ( ) : string ;
914909 applyFilter ( image : VImageData , type : string ) : Promise < Blob > ;
915910 destroy ( ) : void ;
@@ -964,7 +959,7 @@ export interface IconComponent {
964959 PrevPage ?: string ;
965960 ImagePreview ?: string ;
966961}
967- export interface ImageFilterMethod {
962+ export interface ImageFilterItem {
968963 type : string ;
969964 label : string ;
970965}
@@ -1039,6 +1034,23 @@ export interface PagesDeletedEvent {
10391034 readonly pageUids : string [ ] ;
10401035 readonly indices : number [ ] ;
10411036}
1037+ export interface ParsedAnnotation {
1038+ type : string ;
1039+ style : any ;
1040+ }
1041+ export interface ParsedPage {
1042+ fileIndex : number ;
1043+ data ?: Blob ;
1044+ width ?: number ;
1045+ height ?: number ;
1046+ annotations ?: ParsedAnnotation [ ] ;
1047+ bitDepth ?: number ;
1048+ resolutionX ?: number ;
1049+ resolutionY ?: number ;
1050+ rotation ?: number ;
1051+ pageWidth ?: number ;
1052+ pageHeight ?: number ;
1053+ }
10421054export interface PerspectiveViewerConfig {
10431055 canvasStyle ?: CanvasStyle ;
10441056 pageStyle ?: BaseStyle ;
@@ -1219,9 +1231,15 @@ export interface UiConfig {
12191231 style ?: Partial < CSSStyleDeclaration > ;
12201232 className ?: string ;
12211233 label ?: string ;
1222- events ?: Record < string , string > ;
1234+ events ?: Partial < Record < keyof GlobalEventHandlersEventMap , any > > ;
12231235 children ?: ( UiConfig | string ) [ ] ;
12241236}
1237+ export interface UpdatePageOptions {
1238+ fileIndex ?: number ;
1239+ filter ?: string ;
1240+ rotation ?: number ;
1241+ perspectiveQuad ?: Quad ;
1242+ }
12251243export interface VError {
12261244 code : number ;
12271245 message : string ;
@@ -1293,6 +1311,6 @@ export type Quad = [
12931311] ;
12941312export type ToolMode = "pan" | "crop" ;
12951313export type ViewerType = "editViewer" | "perspectiveViewer" | "captureViewer" | "browseViewer" ;
1296- export type WasmModuleName = "core" | "pdf" ;
1314+ export type WasmModuleName = "core" | "pdf" | "proc" ;
12971315
12981316export { } ;
0 commit comments