Detecting documents on an image with the Web Document Scanner SDK
Overview
You can directly run document detection on an image or page and process the results in your own custom UI. This provides flexibility for integrating document detection capabilities into a broader range of applications and user interfaces.
async detectDocument(
image: Image,
config: DocumentScannerConfiguration = {},
consumeType: ConsumeType = 'COPY_IMAGE'
): Promise<Config.DocumentDetectionResult | null> {
Please refer to the API documentation for details on the config and return types.
Example of performing document detection on a page
...
const reader = new FileReader();
reader.readAsArrayBuffer(file);
reader.onload = async (e) => {
const image = ScanbotSDK.Config.Image.fromEncodedBinaryData(reader.result as ArrayBuffer);
const result = await this.sdk.detectDocument(image);
if (result.detectionResult.status === "OK") {
const processor = await this.sdk.createImageProcessor();
const cropped = await processor.crop(image, result.detectionResult.pointsNormalized);
...
} else {
...
};
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial licenseScanbot SDK is part of the Apryse SDK product family
A mobile scan is just the start. With Apryse SDKs, you can expand mobile workflows into full cross‑platform document processing. Whether you need to edit PDFs, add secure digital signatures, or use a fast, customizable document viewer and editor, Apryse gives you the tools to build powerful features quickly.
Learn more
