diff --git a/faq/failed-to-load-resource.md b/faq/failed-to-load-resource.md index fa34b8e3..5b467d52 100644 --- a/faq/failed-to-load-resource.md +++ b/faq/failed-to-load-resource.md @@ -33,10 +33,7 @@ In this case, if you are trying to access an application that integrates a versi Note: the new certificate from Dynamsoft will expire on December 8th, 2023. This means you will need to update the certificate again after this certificate expires. - Method 3. Contact Dynamsoft for a new MSI for client-side. -- For v17.2 or higher versions, use the new API UpdateCert to automatically update the client side certificate before it expires. - -- If you want to automatically update the certificate, please add following code: - +- For v17.2 or higher versions, use the new API UpdateCert to automatically update the client side certificate before it expires. The following is an sample code: ```javascript // Add the code in dynamsoft.webtwain.config.js file Dynamsoft.DWT.ServiceCertUpdateURL= "https://demo.dynamsoft.com/DWT/Resources/dist/cert.zip"; diff --git a/info/api/Dynamsoft_FileUploader.md b/info/api/Dynamsoft_FileUploader.md index 64e577e9..78f87847 100644 --- a/info/api/Dynamsoft_FileUploader.md +++ b/info/api/Dynamsoft_FileUploader.md @@ -342,12 +342,11 @@ DWObject.GenerateURLForUploadData( ## ServerUrl +Specifies the target of the HTTP Post Request of the upload job. This typically is a file on the server. For example: `job.ServerUrl = 'http://www.dynamsoft.com/ScanAndUpload/Actions/SaveToFile.aspx';` + **Syntax** ```typescript -/** - * Specifies the target of the HTTP Post Request of the upload job. This typically is a file on the server. For example: job.ServerUrl = 'http://www.dynamsoft.com/ScanAndUpload/Actions/SaveToFile.aspx'; - */ ServerUrl: string; ``` @@ -363,12 +362,11 @@ ServerUrl: string; ## HttpHeader +Specifies headers in the the HTTP Post Request of the upload job. For example: `job.HttpHeader["Content-Type"] = "text/plain";` + **Syntax** ```typescript -/** - * Specifies headers in the the HTTP Post Request of the upload job. For example: job.HttpHeader["Content-Type"] = "text/plain"; - */ HttpHeader: object; ``` @@ -388,12 +386,11 @@ By default, HttpHeader is an empty object. If left as it is, default headers are ## SourceValue +Specifies the files to be uploaded and the name for it. The files are specified by URLs which can be created with the method GenerateURLForUploadData. This object has a method Add to add file to the job. + **Syntax** ```typescript -/** - * Specifies the files to be uploaded and the name for it. The files are specified by URLs which can be created with the method GenerateURLForUploadData. This object has a method Add to add file to the job. - */ SourceValue: object; ``` @@ -419,12 +416,11 @@ job.SourceValue.Add(url, fileName); ## FormField +Specifies extra fields to be uploaded in the same HTTP post. + **Syntax** ```typescript -/** - * Specifies extra fields to be uploaded in the same HTTP post. - */ FormField: object; ``` @@ -450,17 +446,20 @@ job.FormField.Add("customField", "FormFieldValue"); ## OnUploadTransferPercentage +The event is triggered during the execution of an upload job. It has a parameter which specifies the percentage of the completion of the job. + **Syntax** ```typescript -/** - * The event is triggered during the execution of an upload job. It has a parameter which specifies the percentage of the completion of the job. - * @argument obj A job object. - * @argument sPercentage The percentage of the completion of the job. - */ .OnUploadTransferPercentage = function(obj: Object , sPercentage: number){}; ``` +**Parameters** + +`obj`: A job object. + +`sPercentage`: The percentage of the completion of the job. + **Availability**
@@ -482,16 +481,18 @@ function FileUpload_ OnUploadTransferPercentage (obj, sPercentage){ ## OnRunSuccess +The event is triggered when an upload job completes successfully. + **Syntax** ```typescript -/** - * The event is triggered when an upload job completes successfully. - * @argument obj A job object. - */ .OnRunSuccess = function(obj: Object){}; ``` +**Parameters** + +`obj`: A job object. + **Availability**
@@ -511,26 +512,28 @@ function FileUpload_OnRunSuccess(obj) { --- ---- - ## OnRunFailure +The event is triggered when an upload job completes successfully. + **Syntax** ```typescript -/** - * The event is triggered when an upload job completes successfully. - * @argument obj A job object. - * @argument errorCode The error code. - * @argument errorString The error string. - */ .OnRunFailure = function( -obj: Object -errorCode: number, -errorString: string + obj: Object, + errorCode: number, + errorString: string ){}; ``` +**Parameters** + +`obj`: A job object. + +`errorCode`: The error code. + +`errorString`: The error string. + **Availability**
@@ -546,6 +549,4 @@ job.OnRunFailure = FileUpload_OnRunFailure; function FileUpload_OnRunFailure(obj, errorCode, errorString) { alert(errorString); } -``` - ---- +``` \ No newline at end of file diff --git a/info/api/WebTwain_Viewer.md b/info/api/WebTwain_Viewer.md index 35fe7243..20b3a7a3 100644 --- a/info/api/WebTwain_Viewer.md +++ b/info/api/WebTwain_Viewer.md @@ -46,37 +46,40 @@ permalink: /info/api/WebTwain_Viewer.html ## bind +Create a Dynamsoft Viewer instance and bind it to the WebTwain instance. + **Syntax** ```typescript -/** - * Create a Dynamsoft Viewer instance and bind it to the WebTwain instance. - * @param element Specify an HTML element to create the viewer. - */ bind(element: HTMLDivElement | HTMLElement) : boolean; ``` +**Parameters** + +`element`: Specify an HTML element to create the viewer. + **Example** ```javascript var DWObject, template; Dynamsoft.DWT.CreateDWTObjectEx( - { - WebTwainId: "a", - }, - function (obj) { - DWObject = obj; - template = DWObject.Viewer.getElementById("dwtcontrolContainer_temp3"); - DWObject.Viewer.width=500; -    DWObject.Viewer.height=600; - DWObject.Viewer.show(); - }, - function (errorCode, errorString) { - console.log(errorString); - }); + { + WebTwainId: "a", + }, + function (obj) { + DWObject = obj; + template = DWObject.Viewer.getElementById("dwtcontrolContainer_temp3"); + DWObject.Viewer.width=500; +    DWObject.Viewer.height=600; + DWObject.Viewer.show(); + }, + function (errorCode, errorString) { + console.log(errorString); + }); ``` **Availability** +
@@ -107,16 +110,16 @@ Replace the previous `BindViewer` method. ## clearSelectedAreas +Clear the selected area(s) on the current page. + **Syntax** ```typescript -/** - * Clear the selected area(s) on the current page. - */ clearSelectedAreas(): void; ``` **Availability** +
@@ -149,16 +152,11 @@ DWObject.Viewer.clearSelectedAreas(); ## createCustomElement +Add a custom page DIV element and specify its position and display order. Generate an independent CustomElement object. + **Syntax** ```typescript -/** - * Add a custom page DIV element and specify its position and display order. - * Generate an independent CustomElement object. - * @param element Specify the HTMLDivElement. - * @param location Define where to place the custom element. The allowed values are "left" and "right", and the default value is "right". - * @param ifFull The default value is `false`, that is, the created CustomElement is displayed according to the set area. If set to true, the main viewer will be covered by the CustomElement. - */ createCustomElement( element: HTMLDivElement, location?: string, @@ -185,7 +183,16 @@ interface CustomElement { }; ``` +**Parameters** + +`element`: Specify the HTMLDivElement. + + `location`: Define where to place the custom element. The allowed values are "left" and "right", and the default value is "right". + + `ifFull`: The default value is `false`, that is, the created CustomElement is displayed according to the set area. If set to true, the main viewer will be covered by the CustomElement. + **Availability** +
@@ -233,13 +240,11 @@ The method [ `unbind()` ](#unbind) will dispose all created CustomElement object ## createImageEditor +Generate an independent ImageEditor object. + **Syntax** ```typescript -/** - * Generate an independent ImageEditor object. - * @param editorSettings Configure the object. - */ createImageEditor( editorSettings?: EditorSettings ): ImageEditor; @@ -260,7 +265,12 @@ interface ImageEditor { }; ``` +**Parameters** + +`editorSettings`: Configure the object. + **Availability** +
@@ -412,6 +422,8 @@ The method [ `unbind()` ](#unbind) will dispose all created CustomElement object ## createThumbnailViewer +Generate a independent ThumbnailViewer object. + **Syntax**
@@ -421,7 +433,7 @@ The method [ `unbind()` ](#unbind) will dispose all created CustomElement object > ```typescript /** - * Generate a independent ThumbnailViewer object. + * * @param thumbnailViewerSettings Configure the ThumbnailViewer object */ createThumbnailViewer( @@ -873,16 +885,16 @@ The method [ `unbind()` ](#unbind) will dispose all created CustomElement object ## first +Show the first page and return the index which should be 0. If there is no page in the viewer, -1 is returned. + **Syntax** ```typescript -/** - * Show the first page and return the index which should be 0. If there is no page in the viewer, -1 is returned. - */ first():number; ``` **Availability** +
@@ -915,19 +927,22 @@ DWObject.Viewer.first(); ## fitWindow +Set how the page is fit in the viewer. + **Syntax** ```typescript -/** - * Set how the page is fit in the viewer. - * @param type Specify how to fit. Allowed values are "width" and "height" - */ fitWindow( type?: string ): void ``` +**Parameters** + +`type`: Specify how to fit. Allowed values are "width" and "height" + **Availability** +
@@ -971,19 +986,22 @@ If no parameter is provided, it tries to fit the whole page within the viewer. ## gotoPage +Show the specified page and return its index. + **Syntax** ```typescript -/** - * Show the specified page and return its index. - * @param index Specify the page. - */ gotoPage( index: number ): number; ``` +**Parameters** + +`index`: Specify the page. + **Availability** +
@@ -1016,16 +1034,16 @@ DWObject.Viewer.gotoPage(0); ## hide +Hide the viewer. + **Syntax** ```typescript -/** - * Hide the viewer. - */ hide(): boolean; ``` **Availability** +
@@ -1058,16 +1076,16 @@ DWObject.Viewer.hide(); ## last +Show the last page and return its index. If there is no page in the viewer, -1 is returned. + **Syntax** ```typescript -/** - * Show the last page and return its index. If there is no page in the viewer, -1 is returned. - */ last():number; ``` **Availability** +
@@ -1100,16 +1118,16 @@ DWObject.Viewer.last(); ## next +Show the next page and return its index. If there is no page in the viewer, -1 is returned. + **Syntax** ```typescript -/** - * Show the next page and return its index. If there is no page in the viewer, -1 is returned. - */ next(): number; ``` **Availability** +
@@ -1143,20 +1161,47 @@ var currentIndex = DWObject.Viewer.next(); // return 4 which represents the 5th ## off +Unbind event listener(s) from the specified viewer event. + **Syntax** ```typescript -/** - * Unbind event listener(s) from the specified viewer event. - * @param eventName Specify the event. - * @param callback Specify the listener to remove - */ Viewer.off( eventName: string, callback?: () => void ): void; ``` +**Parameters** + +`eventName`: Specify the event. + +`callback`: Specify the listener to remove + +**Availability** + +
+
+ + + + + + + + + + + + + + + + + +
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
v16.2+ v16.2+ v16.2+ v16.2+ v16.2+
+
+ **Example** ```javascript @@ -1171,20 +1216,46 @@ If no listener is specified, all listeners will be removed. ## on +Bind a listner to the specified event. You can bind one or multiple listeners to the same event. + **Syntax** ```typescript -/** - * Bind a listner to the specified event. You can bind one or multiple listeners to the same event. - * @param eventName Specify the event name. - * @param callback Specify the listner. - */ Viewer.on( eventName: string, callback: (event: ViewerEvent) => void ): void; ``` +**Parameters** + +`eventName`: Specify the event name. +`callback`: Specify the listner. + +**Availability** + +
+ + + + + + + + + + + + + + + + + + +
ActiveXH5(Windows)H5(macOS/TWAIN)H5(macOS/ICA)H5(Linux)
v16.2+ v16.2+ v16.2+ v16.2+ v16.2+
+
+ **Example** ```javascript @@ -1206,16 +1277,16 @@ objThumbnailViewer.on("click", function (dwtEvent, domEvent) { ## previous +Show the previous page and return its index. If there is no page in the viewer, -1 is returned. + **Syntax** ```typescript -/** - * Show the previous page and return its index. If there is no page in the viewer, -1 is returned. - */ previous(): number; ``` **Availability** +
@@ -1249,16 +1320,16 @@ var currentIndex = DWObject.Viewer.previous(); // return 2 which represents the ## render +Refresh the viewer. + **Syntax** ```typescript -/** - * Refresh the viewer. - */ render(): boolean; ``` **Availability** +
@@ -1295,20 +1366,23 @@ DWObject.Viewer.render(); //It will trigger the pageRendered event ## setButtonClass +Set the CSS class name of the specified button. + **Syntax** ``` typescript -/** - * Set the CSS class name of the specified button. - * @param name Specify the button. - * @param className Specify the CSS class name. - */ setButtonClass( name: string, className: string ): boolean; ``` +**Parameters** + +`name`: Specify the button. + +`className`: Specify the CSS class name. + **Usage notes** Use this method to fine-tune the buttons in the viewer with CSS. @@ -1323,13 +1397,11 @@ DWObject.Viewer.setButtonClass("crop", "CropClass"); ## setSelectedAreas +Set one or more rectangular area(s) on the current page. + **Syntax** ```typescript -/** - * Set one or more rectangular area(s) on the current page. - * @param areas Specify the rectangular area(s). - */ setSelectedAreas( areas: Area[] ): void; @@ -1342,7 +1414,12 @@ interface Area { }; ``` +**Parameters** + +`areas`: Specify the rectangular area(s). + **Availability** +
@@ -1365,6 +1442,12 @@ interface Area {
+**Usage notes** + +The coordinates are based on the size of the original page (instead of the size of the viewer). + +This method only works when [ `cursor` ](#cursor) is set to "crosshair". + **Example** ```javascript @@ -1384,31 +1467,29 @@ DWObject.Viewer.setSelectedAreas([ ]); ``` -**Usage notes** - -The coordinates are based on the size of the original page (instead of the size of the viewer). - -This method only works when [ `cursor` ](#cursor) is set to "crosshair". - --- ## setViewMode +Set the view mode of the viewer. + **Syntax** ```typescript -/** - * Set the view mode of the viewer. - * @param columns Specify the number of images per column. - * @param rows Specify the number of images per row. - */ setViewMode( columns: number, rows: number ): boolean; ``` +**Parameters** + +`columns`: Specify the number of images per column. + +`rows`: Specify the number of images per row. + **Availability** +
@@ -1431,30 +1512,31 @@ setViewMode(
+**Usage notes** + +Setting the view mode as -1 by -1 is equivalent to setting [ `singlePageMode` ](#singlepagemode) to true. + + **Example** ```javascript DWObject.Viewer.setViewMode(2, 2); ``` -**Usage notes** - -Setting the view mode as -1 by -1 is equivalent to setting [ `singlePageMode` ](#singlepagemode) to true. - --- ## show +Show the viewer. + **Syntax** ```typescript -/** - * Show the viewer. - */ show(): boolean; ``` **Availability** +
@@ -1487,16 +1569,16 @@ DWObject.Viewer.show(); ## unbind +Unbind and destroy the viewer. + **Syntax** ```typescript -/** - * Unbind and destroy the viewer. - */ unbind(): boolean; ``` **Availability** +
@@ -1519,31 +1601,30 @@ unbind(): boolean;
+**Usage notes** + +Replace the previous `UnbindViewer` method. + **Example** ```javascript DWObject.Viewer.unbind(); ``` -**Usage notes** - -Replace the previous `UnbindViewer` method. - --- ## acceptDrop +Set whether to load files dropped over the viewer area. The default value is true. + **Syntax** ```typescript -/** - * Set whether to load files dropped over the viewer area. - * The default value is true. - */ acceptDrop: boolean; ``` **Availability** +
@@ -1576,15 +1657,14 @@ DWObject.Viewer.acceptDrop = true; ## allowSlide +Set whether to allow image navigation by swiping left or right on the viewer. The default value is true. + ```typescript -/** - * Set whether to allow image navigation by swiping left or right on the viewer. - * The default value is true. - */ allowSlide: boolean; ``` **Availability** +
@@ -1607,29 +1687,28 @@ allowSlide: boolean;
+**Usage notes** + +This API only works if the view mode of the viewer is set to -1 by -1. + **Example** ```javascript DWObject.Viewer.allowSlide = true; ``` -**Usage notes** - -This API only works if the view mode of the viewer is set to -1 by -1. - --- ## allowPageDragging +Set whether to allow page dragging to reorder the pages in the viewer. The default value is true. + ```typescript -/** - * Set whether to allow page dragging to reorder the pages in the viewer. - * The default value is true. - */ allowPageDragging: boolean; ``` **Availability** +
@@ -1664,16 +1743,16 @@ DWObject.Viewer.allowPageDragging = false; //Disable drag&drop. ## background +Return or set the background of the viewer. + **Syntax** ```typescript -/** - * Return or set the background of the viewer. - */ background: string; ``` **Availability** +
@@ -1696,30 +1775,30 @@ background: string;
+**Usage notes** + +Replace the previous `BackgroundColor` method. Now you can specify the backgournd by CSS which may be a single color or even an image. Read more on the [background shorthand CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background). + **Example** ```javascript DWObject.Viewer.background = "rgb(255, 255, 255)"; ``` -**Usage notes** - -Replace the previous `BackgroundColor` method. Now you can specify the backgournd by CSS which may be a single color or even an image. Read more on the [background shorthand CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/background). - --- ## border +Return or set the border of the viewer. + **Syntax** ```typescript -/** - * Return or set the border of the viewer. - */ border: string; ``` **Availability** +
@@ -1742,30 +1821,30 @@ border: string;
+**Usage notes** + +The default value is "1px solid rgb(204, 204, 204)". Now you can specify the border by CSS. Read more on the [border shorthand CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/border). + **Example** ```javascript DWObject.Viewer.border = "2px solid rgb(204, 204, 204)"; ``` -**Usage notes** - -The default value is "1px solid rgb(204, 204, 204)". Now you can specify the border by CSS. Read more on the [border shorthand CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/border). - --- ## cursor +Return or set the shape of the cursor. + **Syntax** ```typescript -/** - * Return or set the shape of the cursor. - */ cursor: string; ``` **Availability** +
@@ -1788,12 +1867,6 @@ cursor: string;
-**Example** - -```javascript -DWObject.Viewer.cursor = "crosshair"; -``` - **Usage Notes** The allowed values are: @@ -1807,20 +1880,26 @@ The allowed values are: If there are selected areas on the page, changing the `cursor` property will clear them. +**Example** + +```javascript +DWObject.Viewer.cursor = "crosshair"; +``` + --- ## height +Return or set the height of the viewer. + **Syntax** ```typescript -/** - * Return or set the height of the viewer. - */ height: number | string; ``` **Availability** +
@@ -1843,6 +1922,12 @@ height: number | string;
+**Usage Notes** + +If a number is assigned, it means that number of pixels (px). If a string is assigned, it is either a fixed size like "500px" or a dynamic size like "50%" which follows standard CSS rules. + +When reading the property, the value is always in pixels no matter what value was set to it. + **Example** ```javascript @@ -1851,26 +1936,20 @@ DWObject.Viewer.height = "350px"; DWObject.Viewer.height = "100%"; ``` -**Usage Notes** - -If a number is assigned, it means that number of pixels (px). If a string is assigned, it is either a fixed size like "500px" or a dynamic size like "50%" which follows standard CSS rules. - -When reading the property, the value is always in pixels no matter what value was set to it. - --- ## idPostfix +Return the postfix of the Ids of the elements in the viewer. + **Syntax** ```typescript -/** - * Return the postfix of the Ids of the elements in the viewer. - */ readonly idPostfix: string; ``` **Availability** +
@@ -1903,17 +1982,16 @@ var myViewerIdPostfix = DWObject.Viewer.idPostfix; ## ifAutoScroll +Return or set whether to scroll the viewer automatically when new pages are imported. Default: true; + **Syntax** ```typescript -/** - * Return or set whether to scroll the viewer automatically when new pages are imported. - * Default: true; - */ ifAutoScroll: string; ``` **Availability** +
@@ -1946,12 +2024,11 @@ DWObject.Viewer.ifAutoScroll = false; ## innerBorder +Return or set the inner border of the viewer. + **Syntax** ```typescript -/** - * Return or set the inner border of the viewer. - */ innerBorder: string; ```