Skip to content

Commit a0bddb8

Browse files
authored
Merge pull request #953 from dynamsoft-docs/preview
update preview 19.3 branch
2 parents f074dab + 5812e8c commit a0bddb8

21 files changed

+171
-191
lines changed

_articles/extended-usage/ocr.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
layout: default-layout
33
needAutoGenerateSidebar: true
4+
needGenerateH3Content: true
5+
noTitleIndex: true
46
title: Dynamic Web TWAIN SDK Features - OCR
57
keywords: Dynamic Web TWAIN, Documentation, OCR
68
breadcrumbText: OCR
@@ -13,7 +15,7 @@ Dynamic Web TWAIN provides an OCR add-on to extract text in your scanned images.
1315

1416
## Requirements
1517

16-
* Windows 10+
18+
* Windows 10 versions >= 1809 and all versions of Windows 11
1719
* A license with the OCR module
1820

1921
## How to Use

_articles/faq/chromium-142-local-network-access-issue.md

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords: Dynamic Web TWAIN, Error Troubleshooting, CORS, unknown address space,
77
breadcrumbText: Error message - Permission was denied for this request to access the unknown address space
88
description: CORS unknown address space
99
date: 2025-11-04 17:21:42 +0800
10-
last_modified: 2025-11-05 17:26:42 +0800
10+
last_modified: 2025-11-26 15:46:00 +0800
1111
---
1212

1313
# Error Troubleshooting
@@ -25,18 +25,38 @@ Starting in **Chromium-based browsers v142+** (released Oct 28, 2025)—includin
2525

2626
You may experience one or more of the following:
2727

28-
***1. Service installer repeatedly prompted***
28+
#### **1) Browser repeatedly prompts to download the service**
29+
The browser asks the user to download/install the Dynamsoft Web TWAIN Service even though it is already installed.
2930

30-
The browser prompts you to download/install the service even though it is already installed.
3131
![DWT_installer.png](/assets/imgs/DWT_installer.png)
3232

33-
***2. Initialization succeeds, but scan/load shows blank images***
33+
#### **2) Initialization succeeds, but scanning / loading returns blank**
34+
Initialization appears successful, but scanned or loaded images are blank.
35+
36+
The browser console (F12 → Console) may show a CORS denial similar to:
3437

35-
The browser console (F12 → Console) shows a CORS rejection similar to:
3638
```shell
37-
Access to fetch at 'https://127.0.0.1:18623/fa/VersionInfo?ts=1761893667670' from origin 'https://your-domain.com' has been blocked by CORS policy: Permission was denied for this request to access the `unknown` address space.
39+
Access to fetch at 'https://127.0.0.1:18623/fa/VersionInfo?ts=1761893667670'
40+
from origin 'https://your-domain.com' has been blocked by CORS policy:
41+
Permission was denied for this request to access the `unknown` address space.
3842
```
3943

44+
---
45+
46+
#### Version-Specific Behavior
47+
48+
The observed behavior depends on Chromium browser version and Dynamic Web TWAIN (DWT) version:
49+
50+
| Browser Version | DWT Version | Resulting Symptom |
51+
|-------------------|------------------|-----------------------------|
52+
| Chromium 142 | < 18.5.0 | Download Prompt |
53+
| Chromium 142 | ≥ 18.5.0 | Blank Images after Scanning |
54+
| Chromium 145+ (*) | Any | Download Prompt |
55+
56+
> (*) **Chromium 145, which can also block websocket, has not been officially released.**
57+
> Behavior is based on pre-release testing and may change once the final release becomes available.
58+
> Edge 143 and Firefox Nightly will have local network permission control as well.
59+
4060
### Root Cause
4161

4262
Chromium 142 introduces a new [Local Network Access security policy](https://chromestatus.com/feature/5152728072060928) requirement.
@@ -67,27 +87,85 @@ Please refer to:
6787

6888
***3. Developer Notes***
6989

70-
**a) Check Permission Programmatically**
90+
**a) If Running Inside an `iframe`**
7191

72-
```javascript
73-
let status = await navigator.permissions.query({ name: "local-network-access" });
74-
console.log(status.state);
75-
```
92+
> [!IMPORTANT]
93+
> If Dynamic Web TWAIN is running inside an iframe from a different origin (cross-origin), you must explicitly grant local-network access in the iframe.
94+
> If the iframe is same-origin, no additional configuration is required.
7695
77-
If not granted, guide users to:
96+
To enable access, specify the `allow` attribute.
97+
For security reasons, it is recommended to allow only the necessary origin rather than using a wildcard.
7898

79-
Chrome → Settings → Privacy and Security → Site Settings → Local network access
99+
```html
100+
<!-- Recommended: restrict to specific origin -->
101+
<iframe src="..." allow="local-network-access your-domain.com"></iframe>
80102

81-
**b) If Running Inside an `iframe`**
103+
<!-- Not recommended: wildcard -->
104+
<!-- <iframe src="..." allow="local-network-access *"></iframe> -->
105+
```
82106

83-
> [!IMPORTANT]
84-
> If your site is embedded in an iframe, you MUST explicitly allow local-network access.
107+
**b) (Optional Enhancement) Permission Check for Improved UX**
85108

86-
Please explicitly allow `local-network-access` in the attributes of the iframe:
87-
```html
88-
<iframe src="..." allow="local-network-access *"></iframe>
109+
You can optionally query Local Network Access permission at runtime.
110+
This isn’t required, but implementing a check can help you proactively notify users and provide clearer guidance if permission is missing.
111+
```javascript
112+
// Before initializing Dynamsoft WebTWAIN (DWT), you can remind users
113+
// that Chrome may ask for Local Network Access permission.
114+
(async () => {
115+
try {
116+
const result = await navigator.permissions.query({ name: "local-network-access" });
117+
console.log(`LNA permission state: ${result.state}`);
118+
119+
const state = result.state; // 'denied', 'prompt', 'granted'
120+
121+
if (state === "denied") {
122+
const currentSite = encodeURIComponent(window.location.origin);
123+
const settingsUrl = `chrome://settings/content/siteDetails?site=${currentSite}`;
124+
console.log(`Local network access is currently denied.\n\nPlease go to:\n${settingsUrl}\nand enable 'Local network access' permission for this site.`);
125+
// Optionally show a UI guide or help link here.
126+
} else if (state === "prompt") {
127+
alert("To connect with the local scanning service, Chrome will ask for 'Local network access' permission.\n\nPlease click 'Allow' when prompted.");
128+
// Proceed to init DWT after this message.
129+
// e.g., Dynamsoft.DWT.Load() or CreateDWTObjectEx or your init DWT function
130+
} else if (state === "granted") {
131+
console.log("Local network access already granted.");
132+
// Initialize DWT or proceed directly.
133+
// e.g., Dynamsoft.DWT.Load() or CreateDWTObjectEx or your init DWT function
134+
} else {
135+
console.log("Unexpected LNA state:", state);
136+
}
137+
138+
} catch (e) {
139+
console.log("This browser does not support Chromium LNA Permissions API yet.");
140+
// Fallback: directly initialize DWT
141+
// Dynamsoft.DWT.Load() or CreateDWTObjectEx or your init DWT function
142+
}
143+
})();
89144
```
145+
If the permission is not granted, consider displaying a user-friendly message directing them to:
146+
147+
> Chrome → Settings → Privacy and Security → Site Settings → Local network access
148+
149+
This approach provides a more polished user experience, especially during onboarding or troubleshooting.
90150

91151
### Roadmap
92152

93153
Dynamsoft plans to add a feature that automatically detects local service connectivity and permission status. If the connection is blocked, users will be prompted with a message and directed to this FAQ page.
154+
155+
Here are the details:
156+
157+
* When local network access is blocked, prompt the user with the following dialog:
158+
159+
![prompt blocked](/assets/imgs/local-network-access/prompt-blocked.jpg)
160+
161+
* Add a sentence about the permission in the service installation dialog, since we cannot determine whether the connection failure is due to the service not being installed or the access being blocked.
162+
163+
![prompt blocked](/assets/imgs/local-network-access/service-installation-dialog.png)
164+
165+
Clicking "Guide" will open the dialog shown above.
166+
167+
This design will be integrated in v19.3. For old versions, we can include an extra js file, which can be retrieved by contacting [support](mailto://support@dynamsoft.com).
168+
169+
## Other Causes
170+
171+
There are other causes of service not being connected. You can find them in [another FAQ](/_articles/faq/service-prompting-to-install-repeatedly.md).

_articles/faq/difference-in-service-and-webassembly-editions.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

_articles/faq/upgrade-to-latest-version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Please refer to the upgrade guide and the release notes below to update your app
2222

2323
[Dynamic Web TWAIN Development - Upgrade Guide](/_articles/indepth/development/upgrade.md){:target="_blank"}
2424

25-
[Dynamic Web TWAIN Schedule - Stable Release](/_articles/info/schedule/stable.md){:target="_blank"}
25+
[Dynamic Web TWAIN Schedule - Stable Release](/_articles/info/schedule/Stable.md){:target="_blank"}
2626

2727
Once you are ready to upgrade, please send an email to <a href="mailto:sales@dynamsoft.com">sales@dynamsoft.com</a> requesting the upgrade be done.
2828

_articles/faq/use-webassembly-to-support-webcam.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

_articles/faq/verify-if-device-is-supported.md

Lines changed: 0 additions & 68 deletions
This file was deleted.

_articles/faq/when-is-pdf-rasterizer-needed.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords: Dynamic Web TWAIN, Addon, pdf rasterizer
77
breadcrumbText: When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?
88
description: When do I need PDF Rasterizer Addon? Can I load existing PDF files into the Dynamic Web TWAIN SDK without the PDF Rasterizer addon?
99
date: 2021-12-01 01:09:41 +0800
10-
last_modified: 2025-01-15 14:58:40 +0800
10+
last_modified: 2025-11-26 15:58:40 +0800
1111
---
1212

1313
# Addon
@@ -16,4 +16,6 @@ last_modified: 2025-01-15 14:58:40 +0800
1616

1717
Third-party generated PDF files may house multiple images, text, or annotations in a single PDF page. As these elements must be rendered within the Dynamic Web TWAIN, it will utilize the PDF rasterizer addon.
1818

19-
When importing a PDF file generated by Dynamic Web TWAIN, or if each page of a third-party PDF holds nothing but a single, unadulterated image, there's no need for the PDF rasterizer addon.
19+
When importing a PDF file generated by Dynamic Web TWAIN, or if each page of a third-party PDF holds nothing but a single image, there's no need for the PDF rasterizer addon.
20+
21+
If you need to append images to an existing PDF and want to keep the original pages instead of rasterized images in the saved PDF, you need to enable the [`preserveUnmodifiedOnSave`](/_articles/info/api/interfaces.md#:~:text=preserveUnmodifiedOnSave){:target="_blank"} property.

_articles/general-usage/initialization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ For demonstration purposes, save the sample in an HTML file (e.g. `helloWorld.ht
6060

6161
Otherwise, click [here](/_articles/general-usage/server-deployment.md) to learn how to deploy DWT on your web server.
6262

63-
> If your environment does not have **Dynamic Web TWAIN Service** installed, a prompt will appear to ask you to install the service. You can learn more about what the service does [here](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md).
63+
> If your environment does not have **Dynamic Web TWAIN Service** installed or local network access is not granted, a prompt will appear to ask you to install the service. You can learn more about what the service does [here](/_articles/faq/what-does-dynamsoft-service-do-on-end-user-machine.md).
6464
6565
Below is more detail on what happens during initialization and how to retrieve the `WebTwain` object.
6666

_articles/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ description: Dynamic Web TWAIN SDK Documentation Homepage
4949
- [Using the DWT RESTful API]({{site.extended-usage}}restful-api.html)
5050
- [Barcode Recognition]({{site.extended-usage}}barcode-processing.html)
5151
- [PDF Handling]({{site.extended-usage}}pdf-processing.html)
52+
- [OCR](/_articles/extended-usage/ocr.md)
5253
<!--- [PDF Compressor (Beta)]({{site.extended-usage}}pdf-compression.html)-->
5354
- [Remote Scan](https://www.dynamsoft.com/remote-scan/docs/introduction/)
5455
- [Configuring System Messages]({{site.extended-usage}}system-message-configuration.html)

_articles/info/api/Addon_OCR.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ description: Dynamic Web TWAIN SDK Documentation API Reference OCR Addon APIs Pa
1313
1414
**Methods**
1515

16+
| [`GetInstalledOCRInfo()`](#getinstalledocrinfo) | [`DetectPageOrientation()`](#detectpageorientation) | [`Recognize()`](#recognize) | [`SaveToPath()`](#savetopath) |
17+
| [`SaveAsBase64()`](#saveasbase64) | [`SaveAsBlob()`](#saveasblob) | | |
18+
1619
---
1720

1821
## GetInstalledOCRInfo()
@@ -27,7 +30,7 @@ GetInstalledOCRInfo(): Promise<OCRInfo>;
2730

2831
**Return Values**
2932

30-
An [`OCRInfo`](/_articles/info/api/interfaces.md#ocrinfo) object.
33+
Promise of an [`OCRInfo`](/_articles/info/api/interfaces.md#ocrinfo) object.
3134

3235
**Availability**
3336

0 commit comments

Comments
 (0)