Skip to content

Commit 7da47e4

Browse files
committed
fix the code in the OCR guide
1 parent ccfcc30 commit 7da47e4

File tree

1 file changed

+4
-3
lines changed
  • _articles/extended-usage

1 file changed

+4
-3
lines changed

_articles/extended-usage/ocr.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Dynamic Web TWAIN provides an OCR add-on to extract text in your scanned images.
2020

2121
### Step One - Install the OCR Package
2222

23-
Download `DynamicWebTWAINOCRPack.zip`, unzip it and run `Install.cmd` as admin to install the OCR package. It will copy the `ocr` folder to the service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder).
23+
Download `DynamicWebTWAINOCRPack.zip`, unzip it and run `Install.cmd` as admin to install the OCR package. It will copy the `ocr` folder to the service's [installation folder](/_articles/extended-usage/dynamsoft-service-configuration.md#installation-folder). (You need to install Dynamic Web TWAIN Service beforehand.)
2424

2525
### Step Two - Write a Basic Document Scanning Page
2626

@@ -264,7 +264,7 @@ Here is the complete code of the demo.
264264
<div>Output:</div>
265265
<input type="button" value="Save as PDF" onclick="SaveAsPDF();" />
266266
<label>Option:
267-
<select>
267+
<select id="outputFormat">
268268
<option value="extralayer">With Extra Text Layer</option>
269269
<option value="plaintext">Plain Text</option>
270270
</select>
@@ -279,6 +279,7 @@ Here is the complete code of the demo.
279279
<script type="text/javascript">
280280
var DWTObject;
281281
var storedOCRResults = {};
282+
282283
Dynamsoft.DWT.RegisterEvent("OnWebTwainReady", function () {
283284
DWTObject = Dynamsoft.DWT.GetWebTwain("dwtcontrolContainer");
284285
DWTObject.Viewer.width = "100%";
@@ -409,7 +410,7 @@ Here is the complete code of the demo.
409410
410411
async function SaveAsPDF(){
411412
try {
412-
let format = document.querySelector('select').value;
413+
let format = document.getElementById('outputFormat').value;
413414
if(format === "extralayer"){
414415
await DWTObject.Addon.OCRKit.SaveToPath(DWTObject.SelectAllImages(),Dynamsoft.DWT.EnumDWT_OCRKitOutputFormat.PDF_WITH_EXTRA_TEXTLAYER);
415416
}else{

0 commit comments

Comments
 (0)