About This Code
Brief Description:
Scan image with TWAIN scanner and insert into Rich Text (R5/Win32)
Contributor:
Andrew Jones
Last Modified:
17 Jun 2002
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
This is the button's LS code:
Declare Function GetActiveWindow Lib {User32} () As Long
Declare Sub SetActiveWindow Lib {User32} (Byval hwnd As Long)
Sub Click(Source As Button)
'**********
'Scan image with TWAIN scanner and insert into Rich Text (R5/Win32)
'written by Dipl. Ing. Wolfgang Flamme (wflamme@mainz-online.de), 2001-03-23
'**********
On Error Goto ErrorHandler
Const SCANFILEPATH$={C:Tempscan.jpg}
Const IMPORTFILETYPE$={JPEG}
Const RTFNAME$={Body}
Const SCANOBJNAME$={objScan}
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim wndhnd As Long
Dim strFile As String
Dim strRTFName As String
Dim objScan As Variant
Set uidoc = ws.CurrentDocument
Set objScan = uidoc.GetObject(SCANOBJNAME)
wndhnd&=GetActiveWindow()
If objScan.ScannerAvailable=True Then
objScan.ShowSelectScanner
objScan.Image=SCANFILEPATH
objScan.ScanTo=2 'StoreOnly
objScan.PageOption=6 'CreateReplace
objScan.ShowSetupBeforeScan=True 'ShowScanDialog
Call objScan.ShowScanPreferences 'ShowScanQualityDialog
Call objScan.StartScan
Call uidoc.GotoField(RTFNAME)
Call uidoc.import(IMPORTFILETYPE, SCANFILEPATH)
Call objScan.CloseScanner
Call SetActiveWindow(wndhnd&)
Else
Msgbox {Error: TWAIN driver not found!}
End If
TheEnd:
Exit Sub
ErrorHandler:
Messagebox {The following unexpected error has occured: } & Trim$(Str(Err)) & {: } & Error$, 0+48+0+0, {Error Message..}
Resume TheEnd
End Sub
Usage / Example
Comments
Posted by Melvin Boulds on 04/26/2005 07:59:07 AMUnexpected Error 213 : ImgScan : Invalid compression type
I keep getting the above error message when using this LS.
I'm using the Epson TWAIN driver ver 5.71, with an Epson Perfection 1250 scanner.
Does anyone have any ideas why this error occurs?
I've tried every possible compression type available through the scanner dialog box in an attempt to resolve the error.