ByteScout PDF Extractor SDK - C# - Find Text - Smart Match - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF Extractor SDK – C# – Find Text – Smart Match

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – C# – Find Text – Smart Match

ByteScout PDF Extractor SDK – C# – Find Text – Smart Match

Program.cs

using System;
using Bytescout.PDFExtractor;

namespace FindTextSmartMatch
{
class Program
{
static void Main(string[] args)
{
TextExtractor extractor = new TextExtractor(“demo”, “demo”);

// Load the document
extractor.LoadDocumentFromFile(“sample2.pdf”);

// Smart match the search string like Adobe Reader
extractor.WordMatchingMode = WordMatchingMode.SmartMatch;

string searchString = “land”;

// Get page count
int pageCount = extractor.GetPageCount();

// Iterate through pages
for (int i = 0; i < pageCount; i++) { // Search for text string if (extractor.Find(i, searchString, false)) { do { // Output search results Console.WriteLine("Found on page " + i + " at location " + extractor.FoundText.Bounds.ToString()); // Now we are getting the found text string extractedString = extractor.FoundText.Text; Console.WriteLine("Found text: " + extractedString); } while (extractor.FindNext()); // Search next occurrence of the search string } } // Cleanup extractor.Dispose(); Console.WriteLine(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } } [/csharp]


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next