Notice: This documentation is archived. For the latest product features and documentation, please visit Dynamsoft Capture Vision Documentation.
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:
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 | Initializes license of DCP. |
Initialize Engine
API Name | Description |
---|---|
engineResourcePath | Specifies the path of WASM engine. |
loadWasm() | Loads and compiles the WASM. |
Create and Destroy
API Name | Description |
---|---|
createInstance() | Creates a CodeParser instance. |
destroyContext() | Destroys the CodeParser instance in WASM. |
Set Code Format
API Name | Description |
---|---|
setCodeFormat() | Sets input code’s format. |
Parse Code Data
API Name | Description |
---|---|
parseData() | Parses code data for readable results. |
Interfaces and Enums
In order to make the code more predictable and readable, the library defines a series of supporting interfaces and enumerations: