Skip to content

Preview #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
89d35d7
Merge pull request #7 from dynamsoft-docs/jenny-branch
Jenny-Jiani Sep 15, 2023
99ad24b
update build to use reusable workflow
DMGithubPublisher Oct 20, 2023
544c7b0
try the preview docs draft
Tom-Dynamsoft Nov 21, 2023
fec3233
updated for dcp 2.x
Tom-Dynamsoft Dec 12, 2023
07ddbae
update small issues 001
Tom-Dynamsoft Dec 12, 2023
df57dd7
update small issues 002
Tom-Dynamsoft Dec 12, 2023
a07eb25
update small issues 003
Tom-Dynamsoft Dec 12, 2023
d783dd4
update small issues 004
Tom-Dynamsoft Dec 12, 2023
91dabcb
update small issues 005
Tom-Dynamsoft Dec 12, 2023
d936527
update small issues 006
Tom-Dynamsoft Dec 12, 2023
2cde9bd
update small issues 007
Tom-Dynamsoft Dec 12, 2023
9e7d927
update small issues 007
Tom-Dynamsoft Dec 12, 2023
0857cb9
update small issues 008
Tom-Dynamsoft Dec 12, 2023
43d74ef
update small issues 009
Tom-Dynamsoft Dec 12, 2023
1bab885
update small issues 010
Tom-Dynamsoft Dec 12, 2023
c28fe1c
update small issues 011
Tom-Dynamsoft Dec 12, 2023
19fbe93
update small issues 012
Tom-Dynamsoft Dec 12, 2023
65f5cf6
remove parsedFields in ParsedResultItem
Tom-Dynamsoft Dec 13, 2023
5aeb37c
update small issues 013
Tom-Dynamsoft Dec 13, 2023
784c2c8
update to internal commit 49b009f6
DMGithubPublisher Dec 15, 2023
e62019f
update to internal commit aad5466b
DMGithubPublisher Jan 17, 2024
95a1a43
update to internal commit c6aec4a1
DMGithubPublisher Jan 18, 2024
5b69265
update to internal commit 0db94b75
DMGithubPublisher Jan 18, 2024
81085f5
update to internal commit b2b075f6
DMGithubPublisher Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
try the preview docs draft
  • Loading branch information
Tom-Dynamsoft committed Nov 21, 2023
commit 544c7b023a8a317f3556a9399bbfac25a07fc687
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dwt_icon: /code-parser/docs/web/assets/img-icon/icon-dwt.svg
dnt_icon: /code-parser/docs/web/assets/img-icon/icon-dnt.svg

release-notes: /code-parser/docs/core/release-notes/
code_types: /code-parser/docs/core/code-types/

useVersionTree: true

Expand Down
184 changes: 184 additions & 0 deletions programming/javascript/api-reference/codeParserModule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
layout: default-layout
title: CodeParser - Dynamsoft Code Parser JavaScript API
description: This is the CodeParser Class of Dynamsoft Code Parser JavaScript SDK.
keywords: CodeParser, api reference, javascript, js
needAutoGenerateSidebar: true
needGenerateH3Content: true
noTitleIndex: true
breadcrumbText: CodeParser
---

# CodeParserModule

## API Index

### Create and Destroy

| API Name | Description |
|---|---|
| [createInstance()](#createinstance) | Creates a `CodeParser` instance. |
| [destroyContext()](#destroycontext) | Destroys the `CodeParser` instance in WASM. |

### Set Code Format

| API Name | Description |
|---|---|
| [setCodeFormat()](#setcodeformat) | Sets input code's format. |

### Parse Code Data

| API Name | Description |
|---|---|
| [parseData()](#parsedata) | Parses code data for readable results. |

<!--

### Set Encryption Key

| API Name | Description |
|---|---|
| [setCryptoPublicKey()](#setcryptopublickey) | Set a public key if code parsing needs. |
| [setCertificate()](#setcertificate) | Set a certificate if code parsing needs. |
-->


## createInstance

Creates a `CodeParser` instance.

```typescript
static createInstance(): Promise<CodeParser>
```

### Return Value

A promise resolving to the created `CodeParser` object.

### Code Snippet

```js
let reader = await Dynamsoft.DCP.CodeParser.createInstance();
```

## destroyContext

Destroys the `CodeParser` instance in WASM. If your page needs to create new instances from time to time, don't forget to destroy unused old instances.

```typescript
destroyContext(): void
```

### Code Snippet

```js
let parser = await Dynamsoft.DCP.CodeParser.createInstance();
// ... parse ...
parser.destroyContext();
```

## setCodeFormat

Sets the code format that needs parsing. See EnumCodeFormat to check if it has the code format you are looking for.

```typescript
setCodeFormat(format: EnumCodeFormat): Promise<void>
```

### Parameters

`format`: specifies the code's format represented by EnumCodeFormat.

### Return Value

A promise that resolves when the operation succeeds.

### Code Snippet

```js
await parser.setCodeFormat(Dynamsoft.DCP.EnumCodeFormat.CF_AUTO);
// ... parse ...
```

## parseData

Parses the code into readable info.

```typescript
parseData(source: number[] | Uint8Array | string): Promise<ParseResult>
```

### Parameters

`source`: specifies the code data represented by a numder[], Uint8Array or string.

### Return Value

A promise resolving to a `ParseResult` object which contains the parsing result.

### Code Snippet

```js
await parser.parseData(YOUR-CODE-THAT-NEEDS-PARSING);
```

### See Also

* [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)
* [ParseResult](./interface/ParseResult.md)

<!--

## setCryptoPublicKey

Sets the public key if your parsing process needs one.

```typescript
setCryptoPublicKey(key: string): Promise<void>
```

### Parameters

`key`: specifies the public key represented by a string.

### Return Value

A promise that resolves when the operation succeeds.

### Code Snippet

```js
let parser = await Dynamsoft.DCP.CodeParser.createInstance();
parser.setCryptoPublicKey(YOUR-PUBLIC-KEY);
// parse
```

## setCertificate

Sets the certificate if your parsing process needs one.

```typescript
setCertificate(value: Uint8Array | ArrayBuffer | string): Promise<void>
```

### Parameters

`value`: specifies the certificate represented by a Uint8Array, ArrayBuffer or string.

### Return Value

A promise that resolves when the operation succeeds.

### Code Snippet

```js
let parser = await Dynamsoft.DCP.CodeParser.createInstance();
parser.setCertificate(YOUR-CERTIFICATE);
// parse
```

### See Also

* [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)

-->
19 changes: 19 additions & 0 deletions programming/javascript/api-reference/enum/EnumMappingStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: default-layout
title: EnumMappingStatus - Dynamsoft Code Parser JavaScript Enum
description: This page shows the EnumMappingStatus enum of Dynamsoft Code Parser for JavaScript.
keywords: EnumMappingStatus, javascript, enum
needAutoGenerateSidebar: false
noTitleIndex: true
breadcrumbText: EnumMappingStatus
---

# EnumMappingStatus

```ts
enum EnumMappingStatus {
MS_NONE = 0,
MS_SUCCEEDED = 1,
MS_FAILED = 2
}
```
19 changes: 19 additions & 0 deletions programming/javascript/api-reference/enum/EnumValidationStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
layout: default-layout
title: EnumValidationStatus - Dynamsoft Code Parser JavaScript Enum
description: This page shows the EnumValidationStatus enum of Dynamsoft Code Parser for JavaScript.
keywords: EnumValidationStatus, javascript, enum
needAutoGenerateSidebar: false
noTitleIndex: true
breadcrumbText: EnumValidationStatus
---

# EnumValidationStatus

```ts
enum EnumValidationStatus {
VS_NONE = 0,
VS_SUCCEEDED = 1,
VS_FAILED = 2
}
```
17 changes: 17 additions & 0 deletions programming/javascript/api-reference/enum/index-v1.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
layout: default-layout
title: Enum Index - Dynamsoft Code Parser JavaScript 1.x API
description: This page shows the Enums of Dynamsoft Code Parser JavaScript SDK version 1.x.
keywords: enums, api reference, javascript, js
needAutoGenerateSidebar: false
noTitleIndex: true
breadcrumbText: Enum Index
---

# Enums

Dynamsoft Code Parser JavaScript SDK v1.x has the following enums.

* [EnumCodeFormat](enumcodeformat.html)
* [EnumErrorCode](enumerrorcode.html)
* [EnumResultInfoType](enumresultinfotype.html)
11 changes: 5 additions & 6 deletions programming/javascript/api-reference/enum/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default-layout
title: Enum Index - Dynamsoft Code Parser JavaScript API
description: This page shows the Enums of Dynamsoft Code Parser JavaScript SDK.
title: Enum Index - Dynamsoft Code Parser JavaScript 2.x API
description: This page shows the Enums of Dynamsoft Code Parser JavaScript SDK version 2.x.
keywords: enums, api reference, javascript, js
needAutoGenerateSidebar: false
noTitleIndex: true
Expand All @@ -10,8 +10,7 @@ breadcrumbText: Enum Index

# Enums

Dynamsoft Code Parser JavaScript SDK has the following enums.
Dynamsoft Code Parser JavaScript SDK 2.x has the following enums.

* [EnumCodeFormat](enumcodeformat.html)
* [EnumErrorCode](enumerrorcode.html)
* [EnumResultInfoType](enumresultinfotype.html)
* [EnumMappingStatus](./EnumMappingStatus.md)
* [EnumValidationStatus](./EnumValidationStatus.md)
86 changes: 86 additions & 0 deletions programming/javascript/api-reference/index-v1.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
layout: default-layout
title: Entry Page - Dynamsoft Code Parser JavaScript API
description: This is the main page of Dynamsoft Code Parser JavaScript SDK API Reference.
keywords: CodeParser, api reference, javascript, js
needAutoGenerateSidebar: true
needGenerateH3Content: true
noTitleIndex: true
breadcrumbText: API Reference
---

# JavaScript API Reference

The Dynamsoft Code Parser JavaScript library comes with one primary class: `CodeParser`.

## CodeParser

A CodeParser takes code data in forms of byte array or plain string as input and returns parsed results. The following code snippet shows its basic usage:

```js
let parser = await Dynamsoft.DCP.CodeParser.createInstance();
parser.setCodeFormat(enumcodeformat);
let result = await parser.parseData(code);
console.log(result);
```

The APIs for this class include:

### Initialize License

| API Name | Description |
|---|---|
| [license](./licenseControl.html#license) | Initializes license of DCP. |

### Initialize Engine

| API Name | Description |
|---|---|
| [engineResourcePath](./initializeEngine.html#engineresourcepath) | Specifies the path of WASM engine. |
| [loadWasm()](./initializeEngine.html#loadwasm) | Loads and compiles the WASM. |

### Create and Destroy

| API Name | Description |
|---|---|
| [createInstance()](./codeParser.html#createinstance) | Creates a `CodeParser` instance. |
| [destroyContext()](./codeParser.html#destroycontext) | Destroys the `CodeParser` instance in WASM. |

### Set Code Format

| API Name | Description |
|---|---|
| [setCodeFormat()](./codeParser.html#setcodeformat) | Sets input code's format. |

### Parse Code Data

| API Name | Description |
|---|---|
| [parseData()](./codeParser.html#parsedata) | Parses code data for readable results. |

<!--

### Set Encryption Key

| API Name | Description |
|---|---|
| [setCryptoPublicKey()](CodeParser.html#setcryptopublickey) | Set a public key if code parsing needs. |
| [setCertificate()](CodeParser.html#setcertificate) | Set a certificate if code parsing needs. |

-->

## Interfaces and Enums

In order to make the code more predictable and readable, the library defines a series of supporting interfaces and enumerations:

### Interfaces

* [CodeParserException](./interface/CodeParserException.html)
* [BasicPersonalInfo](./interface/BasicPersonalInfo.html)
* [ParseResult](./interface/ParseResult.html)

### Enums

* [EnumErrorCode](./enum/EnumErrorCode.html)
* [EnumCodeFormat](./enum/EnumCodeFormat.html)
* [EnumResultInfoType](./enum/EnumResultInfoType.html)
Loading