.NET PDF to Text Converter SDK

C#: Convert PDF & Extract Text
CnetSDK .NET PDF to Text Converter SDK can be used in Visual C# programming. This SDK works as a C#.NET PDF to text converter library and C#.NET PDF text extractor library. You can easily transform & convert PDF to txt file, and recognize & extract text from PDF document page(s). This online guide provides detailed C# class codes for your reference.
C# PDF TO TEXT CONVERTER & TEXT EXTRACTOR
To begin with, please add C# project reference to our .NET PDF Converter & Text Extractor. Then, you can use well designed C#.NET APIs to convert PDF to txt file and extract text from PDF document page(s).

Please note that CnetSDK .NET PDF to Text Converter & PDF Text Extractor online trial will only extract text from the first five PDF pages or convert the pages to txt file. To convert or extract all PDF pages, please order a license.
C# PDF TO TEXT CONVERTER & PDF EXTRACTOR APIS
After downloading CnetSDK .NET PDF Converter & PDF Extractor for Text/Txt, you will find a C# PDF library called CnetSDK.PDFtoText.Converter.Trial.dll. This .NET PDF to Txt Converter & PDF Text Extractor dll provides C# developers with mature & robust .NET APIs and methods.

You can easily load a PDF document from Stream or String in C# project, and then define which PDF page(s) text information will be recognized and extracted. Or you can directly transform and convert the whole PDF to txt file in your Visual Studio C# project.

// API for Loading PDF from a file stream or memory stream.
public bool LoadPdfFile(Stream Stream);

// API for loading a PDF from a local file on your disk.
public bool LoadPdfFile(string fileName);


// API for setting which PDF page(s) to extract text.
public int FilePageCount;


// API for outputting text to a String Object.
public String ConvertToText(int pageIndex);
public String ConvertToText();


// API for transforming and converting whole PDF file to a txt file.
public void ConvertToTextFile(string fileName);

USE C# CODE TO CONVERT PDF TO TEXT FILE
This .NET PDF to txt converter library enables C# programmer to easily load a PDF document into Visual Studio C# project, and then transform & convert PDF to a text/txt file. The following C# sample code illustrates how to load a PDF from a local file and convert it to txt file accurately.
using System;
using System.Text;
using CnetSDK.PDFtoText.Converter.Trial;
 
namespace ConvertPDFtoTextFileinCsharp
{
  class Program
  {
    static void Main(string[] args)
    {
      // Create an instance of CnetSDK PDF to txt converter object.
      CSPdfExtractor ConvertPDFtoTXT = new CSPdfExtractor();


      // Load a PDF document from a local file.
      ConvertPDFtoTXT.LoadPdfFile("F:/CnetSDKTest.pdf");


      // Transform and convert PDF file text to txt file.
      ConvertPDFtoTXT.ConvertToTextFile("F:/CnetSDKTest.txt");
    }
  }
}

USE C# CODE TO EXTRACT TEXT FROM PDF FILE
Just like OCR technology, our .NET PDF extractor library enables C# programmer to recognize and extract PDF text from a single page, a range of PDF pages, or whole PDF document. And the following Visual C# sample code tells how to achieve fast and accurate PDF text extraction.
using System;
using System.Text;
using CnetSDK.PDFtoText.Converter.Trial;
 
namespace ExtractTextfromPDFinCsharp
{
  class Program
  {
    static void Main(string[] args)
    {
      // Create an instance of CnetSDK PDF text extractor object.
      CSPdfExtractor TextExtractor = new CSPdfExtractor();


      // Load a PDF from a local file.
      TextExtractor.LoadPdfFile("F:/CnetSDKTest.pdf");


      // Get the total page count of loaded PDF document.
      int Count = TextExtractor.FilePageCount;
 
      for (int i = 0; i < Count; i++)
      {
         // Recognize and extract text from each PDF page.
         string PdfPageText = TextExtractor.ConvertToText(i);
         Console.WriteLine(PdfPageText);
      }
         Console.ReadKey();
 
      // Recognize and extract text from whole PDF file.
      // string AllText = TextExtractor.ConvertToText();
      // Console.WriteLine(AllText);
    }
  }
}

If you are developing a .NET PDF application using VB.NET, you may refer to this online developer guide: VB.NET Tutorial: Convert PDF to Text File & Extract Text from PDF.