To
scan document from oracle forms to shared folder
In This
post, we will explain one way to scan document to pdf or image forms, the
attached forms use the following third party tool (naps2) which scan to pdf
using command line parameter
In
addition, we will call VBscipt which in
turn call naps2 file using command prompt using java bean, this java bean simply
execute any command prompt from oracle forms as below code
Step
:-1 frist add bean to your forms
Step
:-2 add button to your forms which will call the following code:-
FILE_NAME
will be file location example d:\f.pdf or \\filserver\doc\a.pdf
pdfscan.vbs
is the vbscript wich accept filename as input and it call naps2 file
pdfscan.vbs
can be on clinet user machine or smpliy in sahred folder like \\filserver\doc\
declare
CMD varchar2(300);
begin
CMD:='cmd
/c wscript \\filserver\doc\pdfscan.vbs '||:FILE_NAME;
Set_Custom_Property( 'BL.BEAN', 1, 'SET_PROG',
CMD ) ;
END;
Step
:-3 using notpade past this code and save it as pdfscan.vbs and put this file
in location we can be accessed from any forms like \\filserver\doc\pdfscan.vbs
=====================================================
Option
Explicit
Dim
oTxtFile
Dim
InputFile
Dim
objFSO, strDoc, objFile,oWord,oShell
InputFile=
WScript.Arguments(0)
'Msgbox InputFile
With
(CreateObject("Scripting.FileSystemObject"))
If .FileExists(InputFile) Then
Msgbox "File Exist"
Set oShell = WScript.CreateObject
("WScript.Shell")
'Msgbox "C:\NAPS2\NAPS2.Console.exe
-i "& InputFile &" -o "& InputFile &"
-f"
oShell.run "C:\NAPS2\NAPS2.Console.exe -i
"& InputFile &" -o "& InputFile &" -f"
Set oShell = Nothing'
Else
'Set oTxtFile =
.CreateTextFile(InputFile)
Msgbox "File Created"
Set oShell = WScript.CreateObject
("WScript.Shell")
oShell.run
"""C:\NAPS2\NAPS2.Console.exe"" -o"
&InputFile
Set oShell = Nothing'
End If
End
With
WScript.Quit(1)
=========================================
Step :-4 just scan
Thanks
attached form:-