Web Demos


Explore the flexibe barcode reading settings to optimize for your specific usage scenario.


Try the most popular web scanner features: scan images, import local images and PDF files, edit, save to local, upload to database, and etc.


Transform any camera-equipped devices into real-time, browser-based barcode and QR code scanners.


Detects the machine-readable zone of a passport, scans the text, and parses into human-readable data.




Resource Base
Table of contents

JavaScript API Reference



API Name Description
createInstance() Creates a CameraEnhancer instance.
defaultUIElementURL Returns or sets the URL of the .html file that defines the default UI Element.
getUIElement() Returns the HTML element that is used by the CameraEnhancer instance.
setUIElement() Specifies an HTML element for the CameraEnhancer instance to use as its UI element.
onWarning A callback which is triggered when the running environment is not ideal.

Camera Control

API Name Description
ifSkipCameraInspection Returns or sets whether to skip camera inspection at initialization to save time.
ifSaveLastUsedCamera Returns or sets whether to save the last used camera and resolution.
getAllCameras() Returns infomation of all available cameras on the device.
selectCamera() Chooses a camera as the video source.
getSelectedCamera() Returns information about the selected / current camera.
open() Turn on the camera to start streaming live video.
close() Stops video streaming and releases the camera.
isOpen() Returns whether the selected camera is turned on / occupied.
pause() Pauses video streaming without releasing the camera.
resume() Resumes video streaming.
setResolution() Sets the resolution of the current video input.
getResolution() Returns the resolution of the current video input.
getResolutions() Returns the resolutions supported by the current video input.
videoSrc Sets or returns the source of the video.

Advanced Camera Control

API Name Description
setFrameRate() Adjusts the frame rate.
getFrameRate() Returns the real-time frame rate.
turnOnTorch() Turns on the torch/flashlight if the current camera supports it.
turnOffTorch() Turns off the torch/flashlight.
setZoom() Sets the zoom level of the video.
setFocus() Sets the focus mode and focus distance of the camera.
getFocus() Gets the focus mode and focus distance of the camera.
getCapabilities() Inspects and returns the capabilities of the selected camera.
getCameraSettings() Returns the current values for each constrainable property of the selected camera.
setColorTemperature() Adjusts the color temperature of the selected camera.
setExposureCompensation() Sets the exposure compensation index of the selected camera.

Frame Acquisition

API Name Description
setScanRegion() Specifies which part of the original video is considered when processing frames.
getScanRegion() Returns the scan region.
getFrame() Returns a DCEFrame object which contains the image data of the latest frame from the video input.
getFrameFromBuffer() Returns a DCEFrame object which contains the image data of the first buffered frame.
startFetchingLoop() Starts a fetching loop that continuously put frames in a buffer.
stopFetchingLoop() Stops the fetching loop.
isFetchingLoopStarted() Returns the state of the fetching loop.
frameColorMode Sets or returns the color mode of the images generated by getFrame().
maxNumberOfFramesInBuffer Sets or returns how many frames can be buffered.
numberOfFramesInBuffer Returns how many frames there are in the buffer.
loopInterval Returns or sets the start time of the next fetch operation.
singleFrameMode Returns or sets whether to enable the singe-frame mode.


API Name Description
getVisibleRegion() Returns a Region object which specifies which part of the original video is shown in the video element.
addScanRegionOverlayCanvas() Adds a canvas of the same size as the scan area directly above the scan area.
removeScanRegionOverlayCanvas() Removes the specified Canvas element.
ifShowScanRegionMask Returns or sets whether the scan region mask is shown.
ifShowScanRegionLaser Returns or sets whether the laser indicator is shown in the scan region.
setScanRegionMaskStyle() Sets the styles for the scan region mask.
setVideoFit() Sets the object-fit CSS property of the video element.
getVideoFit() Returns the value of the object-fit CSS property of the video element.
setViewDecorator() Sets and shows the view decorator.
getViewDecorator() Gets what view decorator is shown.
setViewDecoratorLineWidth() Sets the line width for drawing the view decorator.
setViewDecoratorStrokeStyle() Sets the stroke style for drawing the view decorator..
setViewDecoratorFillStyle() Sets the fill style for drawing the view decorator.
setViewDecoratorMaskFillStyle() Sets the fill style for drawing the ask for the view decorator.
createDrawingLayer() Creates a DrawingLayer object and put it in an array of DrawingLayers.
getDrawingLayer() Gets the DrawingLayer specified by its ID.
getDrawingLayers() Returns an array of all DrawingLayer objects.
clearDrawingLayers() Removes all DrawingLayers.
createDrawingStyle() Creates a new DrawingStyle object and returns its ID.
getDrawingStyle() Returns the DrawingStyle object specified by its Id.
getDrawingStyles() Returns all DrawingStyle objects.
updateDrawingStyle() Updates an existing DrawingStyle specified by its ID.
setOriginalImage() Sets the original image to be drawn on the editor canvas.
getOriginalImage() Returns the original image shown on the editor.
showOriginalImage() Shows the original image.
hideOriginalImage() Hides the original image.
deleteOriginalImage() Deletes the original image and remove the canvas that shows it.
getSelectedDrawingItems() Returns the selected DrawingItem object(s).

Auxiliary APIs

API Name Description
on() Attaches an event handler function for a built-in event.
off() Removes an event handler.
offAll() Removes all event handlers from the specified event. If no event is specified, remove all event handlers.
dispose() Releases all resources used by the CameraEnhancer instance.
isDisposed A readonly boolean value indicating whether the CameraEnhancer instance has been disposed.
getVersion() Returns the version of the library.
detectEnvironment() Returns a report on the current running environments.


API Name Description
getId() Returns the ID of the DrawingLayer.
addDrawingItems() Adds DrawingItem(s) to the DrawingLayer.
getDrawingItems() Returns all DrawingItem(s) of the DrawingLayer.
setDrawingItems() Replaces all DrawingItem(s) of the DrawingLayer with new ones.
hasDrawingItem() Checks out if a DrawingItem belongs to the layer.
removeDrawingItems() Removes DrawingItem(s) from the DrawingLayer.
clearDrawingItems() Removes all DrawingItem(s) from the DrawingLayer.
setDrawingStyle() Sets the style for the DrawingLayer or for a particular mediaType or for a particular mediaType in a particular state.
setVisible() Shows or hides the DrawingLayer.
isVisible() Returns whether the DrawingLayer is visible.
renderAll() Renders all DrawingItems, usually required when the style for one or more items is changed.
onSelectionChange() An event handler that is triggered when different DrawingItem(s) gets selected/deselected on the DrawingLayer.
setMode() Changes the mode of the layer.
getMode() Returns the current mode.


Type Name Description
DT_Rect Defines a DrawingItem the shape of a rectangle.
DT_Arc Defines a DrawingItem the shape of a arc.
DT_Line Defines a DrawingItem the shape of a line.
DT_Polygon Defines a DrawingItem the shape of a polygon.
DT_Text Defines a DrawingItem that draws text.
DT_Image Defines a DrawingItem that draws an image.
DT_Group Defines a DrawingItem which is a combination of more than one DrawingItem of the other six types.


This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 2.3.2
  • Version 2.3.1
  • Version 2.1.0
  • Version 2.0.0
  • Version 1.0.3
  • Version 1.0.1
  • Version 1.0.0
Change +
© 2003–2022 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support