No announcement yet.

VBA Automating OCR

  • Filter
  • Time
  • Show
Clear All
new posts

  • VBA Automating OCR

    I am currently trying to automate the task of opening a number of PDF files in a folder 1 at a time, and the using the OCRAndExportToExcel method within the PhantomPDF.Document option within VBA, export the text data to an excel file so that I can then pull out the data I require (from physical letters received and scanned in PDF format).

    Currently I am testing the OCR function using only 1 fixed file.

    The issue I am having is that the OCR will only pick text as text not in the image, within the Syntax HRESULT OCRAndExportToExcel(BSTR ExcelPathname, SHORT start, SHORT end, VARIANT_BOOL bAllPages, VARIANT_BOOL bText); which is on the API reference document it is not giving me the last option to select the Boolean for bText.

    I have attached an image, which in the red box is the syntax I have put along with the help reference that VBA shows where you can see that the bText option is not available.

    The green box is the syntax description (for bText) from the API document, with the needed option underlined blue with the description from the API document in the blue box for bText.

    Any help will be much appreciated, and if any further information is needed just ask.



  • #2
    Nibbs73 ,Thanks for your post. We have submitted this situation " VBA Automating OCR: the OCR will only pick text as text not in the image" you mentioned to our related team who are responsible for VBA module for further analysis with report ID#QCPHANTOM-23351.Any updates about this issue,we will get back to you again.


    • #3
      Nibbs73 ,For this situation you reported,firstly please help to go to "Help" tab in Foxit PhantomPDF,click on "About Foxit PhantomPDF" to check its version number. If it is not the latest version 9.7.1,please install the latest version 9.7.1 of Foxit PhantomPDF by downloading it from the link below:
      If the issue still persists in the newest version,please help to do the following procedures to see if it helps:
      1: Download the file"" from the link below:
      ,unzip it to get two dll files which are "EasyCall64.dll" and "EasyCall.dll".
      2:Close Foxit PhantomPDF and MS excel if you have them opened. Place the above mentioned two newly downloaded dll files into your Foxit PhantomPDF's main installation folder to replace its original two dll files there.By default,its main installation folder is:
      C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF
      C:\Program Files\Foxit Software\Foxit PhantomPDF
      3:Unregister and register the mentioned two dll files again by doing the following steps:
      (Assume you are having PhantomPDF, which is installed on "C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF" on Windows 8 or greater.)
      A:Right click on Windows Start, choose Command Prompt (Admin).Choose Yes, if there is a "User Account Control' confirming message.
      B:In the command line, input
      regsvr32 /u "C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\EasyCall.dll", press Enter.
      regsvr32.exe "C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\EasyCall.dll", press Enter.
      regsvr32 /u "C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\EasyCall64.dll", press Enter.
      regsvr32.exe "C:\Program Files (x86)\Foxit Software\Foxit PhantomPDF\EasyCall64.dll", press Enter.
      You will see success messages displayed on the screen if the registration succeeded.
      4:Open MS execl file to configure the VBA editor again.

      Any result,please let us know.
      Attached Files


      • #4
        Nibbs73 Regarding the issue "VBA Automating OCR: the OCR will only pick text as text not in the image(report ID#QCPHANTOM-23351)" that you referred in this thread,please help to
        install our latest version 10 of Foxit PhantomPDF to give it a try to see if it helps? We have restructure VBA feature since V10.0 to make it more multi-functional, stable, and reliable.
        To know how to work with Foxit PhantomPDF V10.0 and above via VBA scripts in Microsoft office,please refer to Foxit PhantomPDF v10 user manual:
        and VBA API reference document: