Platforms to show: All Mac Windows Linux Cross-Platform
/iOS/Scan Document/Scan Document
Required plugins for this example: MBS iOS Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /iOS/Scan Document/Scan Document
This example is the version from Sun, 5th Nov 2022.
Project "Scan Document.xojo_binary_project"
Class MainScreen Inherits MobileScreen
Control Output Inherits MobileImageViewer
ControlInstance Output Inherits MobileImageViewer
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
End Control
Control Button1 Inherits MobileButton
ControlInstance Button1 Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
StartScan
End EventHandler
End Control
Sub DocumentScanDidCancel(controller as VNDocumentCameraViewControllerMBS)
// nothing to do
End Sub
Sub DocumentScanDidFailWithError(controller as VNDocumentCameraViewControllerMBS, error as NSErrorMBS)
MessageBox "Failed to get image: "+error.LocalizedDescription
End Sub
Sub DocumentScanDidFinishWithScan(controller as VNDocumentCameraViewControllerMBS, scan as VNDocumentCameraScanMBS)
Dim pageCount As Integer = scan.pageCount
If pageCount > 0 Then
Output.Image = scan.pictureOfPageAtIndex(0)
End If
End Sub
Sub StartScan()
If VNDocumentCameraViewControllerMBS.Supported Then
scanner = New VNDocumentCameraViewControllerMBS
// we skip making a subclass and just connect the events
// weak mode, so we avoid circular reference
AddHandler Scanner.DidCancel, WeakAddressOf DocumentScanDidCancel
AddHandler Scanner.DidFailWithError, WeakAddressOf DocumentScanDidFailWithError
AddHandler Scanner.DidFinishWithScan, WeakAddressOf DocumentScanDidFinishWithScan
scanner.present
Else
MessageBox "Not supported for this device."
End If
End Sub
Property Scanner As VNDocumentCameraViewControllerMBS
End Class
Class App Inherits MobileApplication
End Class
Class LaunchScreen Inherits iosView
End Class
ExternalFile info
End ExternalFile
End Project
The items on this page are in the following plugins: MBS iOS Plugin.