The sample source codes on this page shows how to find text in pdf with pdf extractor sdk in VB.NET. ByteScout PDF Suite is the bundle that provides six different SDK libraries to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can be applied to find text in pdf with pdf extractor sdk using VB.NET.
These VB.NET code samples for VB.NET guide developers to speed up coding of the application when using ByteScout PDF Suite. Follow the instructions from scratch to work and copy the VB.NET code. Complete and detailed tutorials and documentation are available along with installed ByteScout PDF Suite if you’d like to learn more about the topic and the details of the API.
The trial version of ByteScout PDF Suite can be downloaded for free from our website. It also includes source code samples for VB.NET and other programming languages.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Imports System.Drawing
Imports Bytescout.PDFExtractor
Class Program
Friend Shared Sub Main(args As String())
' Create Bytescout.PDFExtractor.TextExtractor instance
Dim extractor As New TextExtractor()
extractor.RegistrationName = "demo"
extractor.RegistrationKey = "demo"
' Load sample PDF document
extractor.LoadDocumentFromFile(".\sample1.pdf")
' Set the matching mode.
' WordMatchingMode.None - treats the search string as substring;
' WordMatchingMode.ExactMatch - treats the search string as separate word;
' WordMatchingMode.SmartMatch - will find the word in various forms (like Adobe Reader).
extractor.WordMatchingMode = WordMatchingMode.ExactMatch
Dim pageCount As Integer = extractor.GetPageCount()
For i As Integer = 0 To pageCount - 1
' Search each page for "ipsum" string
If extractor.Find(i, "ipsum", False) Then
Do
Console.WriteLine("")
Console.WriteLine(("Found on page " & i & " at location ") + extractor.FoundText.Bounds.ToString())
Console.WriteLine("")
' Iterate through each element in the found text
For Each element As SearchResultElement In extractor.FoundText.Elements
Console.WriteLine((((("Element #" + element.Index.ToString() & " at left=") + element.Left.ToString() & "; top=") + element.Top.ToString() & "; width=") + element.Width.ToString() & "; height=") + element.Height.ToString())
Console.WriteLine("Text: " + element.Text)
Console.WriteLine("Font is bold: " + element.FontIsBold.ToString())
Console.WriteLine("Font is italic:" + element.FontIsItalic.ToString())
Console.WriteLine("Font name: " + element.FontName)
Console.WriteLine("Font size:" + element.FontSize.ToString())
Console.WriteLine("Font color:" + element.FontColor.ToString())
Next
Loop While extractor.FindNext()
End If
Next
' Cleanup
extractor.Dispose()
Console.WriteLine()
Console.WriteLine("Press any key to continue...")
Console.ReadLine()
End Sub
End Class
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: