Results 1 to 6 of 6

Thread: VB - Scanning Acrobat from VB Application

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    62

    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:
    1. Sub ScanFile()
    2.   Dim adobe As CAcroApp
    3.   Dim ok As Integer
    4.   Dim pdDoc As CAcroPDDoc
    5.   Dim AvDoc As CAcroAVDoc
    6.   Dim pdffile As String
    7.  
    8.   Set adobe = CreateObject("AcroExch.app")
    9.   'Set AvDoc = CreateObject("AcroExch.avdoc")
    10.   pdffile = "C:\temp.pdf"
    11.  
    12.   ok = adobe.MenuItemExecute("Scan")
    13.   Set AvDoc = adobe.GetActiveDoc
    14.  
    15.   If AvDoc.IsValid Then
    16.     Set pdDoc = AvDoc.GetPDDoc
    17.    
    18.     If pdDoc.Save(1, pdffile) <> True Then
    19.       MsgBox ("Failed to save " & pdffile)
    20.     End If
    21.    
    22.     pdDoc.Close
    23.   Else
    24.     MsgBox ("Invalid file")
    25.   End If
    26.  
    27.   AvDoc.Close (0)
    28.   adobe.Exit
    29. End Sub

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    62

    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.

  4. #4
    New Member
    Join Date
    Jan 2005
    Posts
    2

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    62

    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?

  6. #6
    New Member
    Join Date
    Jan 2005
    Posts
    2

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width