ByteScout Data Extraction Suite - VBScript - Find text in pdf with pdf extractor sdk - ByteScout

ByteScout Data Extraction Suite – VBScript – Find text in pdf with pdf extractor sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Data Extraction Suite – VBScript – Find text in pdf with pdf extractor sdk

How to find text in pdf with pdf extractor sdk in VBScript and ByteScout Data Extraction Suite

Continuous learning is a crucial part of computer science and this tutorial shows how to find text in pdf with pdf extractor sdk in VBScript

Sample source code below will display you how to manage a complex task like find text in pdf with pdf extractor sdk in VBScript. ByteScout Data Extraction Suite is the set that includes 3 SDK products for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK and you can use it to find text in pdf with pdf extractor sdk with VBScript.

The SDK samples given below describe how to quickly make your application do find text in pdf with pdf extractor sdk in VBScript with the help of ByteScout Data Extraction Suite. This VBScript sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! This basic programming language sample code for VBScript will do the whole work for you to find text in pdf with pdf extractor sdk.

All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

FindTextAndGetCoordinates.vbs
      
' Create Bytescout.PDFExtractor.TextExtractor object Set extractor = CreateObject("Bytescout.PDFExtractor.TextExtractor") extractor.RegistrationName = "demo" extractor.RegistrationKey = "demo" ' Load sample PDF document extractor.LoadDocumentFromFile("..\..\sample1.pdf") ' Set the matching mode: ' 0 = WordMatchingMode.None - treats the search string as substring; ' 1 = WordMatchingMode.SmartMatch - will find the word in various forms (like Adobe Reader); ' 2 = WordMatchingMode.ExactMatch - treats the search string as separate word. extractor.WordMatchingMode = 2 ' Get page count pageCount = extractor.GetPageCount() For i = 0 To PageCount - 1 If extractor.Find(i, "ipsum", false) Then ' parameters are: page index, string to find, case sensitivity. Do foundMessage = "Found word 'ipsum' on page #" & CStr(i) & " at { " & _ "x = " & CStr(extractor.FoundText.Left) & "; " & _ "y = " & CStr(extractor.FoundText.Top) & "; " & _ "width = " & CStr(extractor.FoundText.Width) & "; " & _ "height = " & CStr(extractor.FoundText.Height) & " }" elementInfo = "" ' Iterate through elements of the found text object For j = 0 to extractor.FoundText.ElementCount - 1 Set element = extractor.FoundText.GetElement(j) elementInfo = elementInfo & "Element #" & CStr(j) & " at { x = " & CStr(element.Left) & "; y = " & CStr(element.Top) & "; width = " & CStr(element.Width) & "; height = " & CStr(element.Height) & vbCRLF elementInfo = elementInfo & "Text: " & CStr(element.Text) & vbCRLF elementInfo = elementInfo & "Font is bold: " & CStr(element.FontIsBold) & vbCRLF elementInfo = elementInfo & "Font is italic: " & CStr(element.FontIsItalic) & vbCRLF elementInfo = elementInfo & "Font name: " & CStr(element.FontName) & vbCRLF elementInfo = elementInfo & "Font size: " & CStr(element.FontSize) & vbCRLF elementInfo = elementInfo & "Font color (as OLE_COLOR): " & CStr(element.FontColorAsOleColor) & vbCRLF & vbCRLF Next WScript.Echo foundMessage & vbCRLF & vbCRLF & elementInfo Loop While extractor.FindNext End If Next WScript.Echo "Done" Set extractor = Nothing

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Data Extraction Suite Home Page

Explore ByteScout Data Extraction Suite Documentation

Explore Samples

Sign Up for ByteScout Data Extraction Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next