VB - Scanning Acrobat from VB Application
This is a sample code that shows how to scan documents in adobe and save them from a VB application.
VB Code:
Sub ScanFile()
Dim adobe As CAcroApp
Dim ok As Integer
Dim pdDoc As CAcroPDDoc
Dim AvDoc As CAcroAVDoc
Dim pdffile As String
Set adobe = CreateObject("AcroExch.app")
'Set AvDoc = CreateObject("AcroExch.avdoc")
pdffile = "C:\temp.pdf"
ok = adobe.MenuItemExecute("Scan")
Set AvDoc = adobe.GetActiveDoc
If AvDoc.IsValid Then
Set pdDoc = AvDoc.GetPDDoc
If pdDoc.Save(1, pdffile) <> True Then
MsgBox ("Failed to save " & pdffile)
End If
pdDoc.Close
Else
MsgBox ("Invalid file")
End If
AvDoc.Close (0)
adobe.Exit
End Sub
Re: VB - Scanning Acrobat from VB Application
Just a note: This wil only work for Full versions of Acrobat.
Also, will this work for 5 & 6?
Re: VB - Scanning Acrobat from VB Application
I know this works with Adobe Acrobat 5.0 with Fujitsu 15c TWAIN scanner since I have tried it. I don't have Adobe 6.0 but it should work with Adobe 6.0.
Re: VB - Scanning Acrobat from VB Application
What is meant by Full Versions of Adobe???
I have the Full version of Acrobat Standard 6.0 and this code does not seem to be working?
Thanks,
Rog
Re: VB - Scanning Acrobat from VB Application
Rogo:
What seems to be the problem? Also, the scanner you are using, is it a TWAIN compatible?
Re: VB - Scanning Acrobat from VB Application
The problem is the following.....
I have Acrobat 6.0.3 Standard. When running this code I get an error of invalid file.
Adobe does not come up nor does the scanner software come up either.
I do have a scanner plugged in and turned on. The scanner works well with Photoshop and word.
I have traced the code and basically I am getting to the
If AvDoc.IsValid Then
Here it fails.
I did look into the Adobe Acrobat program and cannot for the life of me see any menu item that allows a scan to document?
I have looked on the Adobe site and belive that I can, but don't know how.
Thanks,
Rog