Appearance
Mobile Document Scanner API Reference / ScanRegion
Interface: ScanRegion
Defined in: src/views/DocumentScannerView.ts:62
Set the scan region within the DocumentScannerView viewfinder for document scanning from the DocumentScannerViewConfig.
Remarks
MDS determines the scan region with the following steps:
- Use ScanRegion.ratio to set the height-to-width ratio of the rectangular scanning region, then scale the rectangle up to fit within the viewfinder.
- Translate the rectangle upward by the number of pixels specified by ScanRegion.regionBottomMargin.
- Create a visual border for the scanning region boundary on the viewfinder with a given stroke width in pixels and stroke color.
Example
Create a scan region with a height-to-width ratio of 3:2, translated upwards by 20 pixels, with a green, 3 pixel-wide border in the viewfinder:
javascript
scanRegion {
ratio: {
width: 2,
height: 3,
},
regionBottomMargin: 20,
style: {
strokeWidth: 3,
strokeColor: "green",
},
}Properties
ratio
ratio:
object
Defined in: src/views/DocumentScannerView.ts:68
The aspect ratio of the rectangular scan region.
height
height:
number
The height of the rectangular scan region.
width
width:
number
The width of the rectangular scan region.
regionBottomMargin
regionBottomMargin:
number
Defined in: src/views/DocumentScannerView.ts:85
Bottom margin below the scan region measured in pixels.
style
style:
object
Defined in: src/views/DocumentScannerView.ts:91
The styling for the scan region outline in the viewfinder.
strokeColor
strokeColor:
string
The color of the outline of the scan region.
strokeWidth
strokeWidth:
number
The pixel width of the outline of the scan region.