PDF .NET Library Documentation - PDF Technologies, Inc.
The function extract text from a PDF Document.

Namespace:  PDFTech
Assembly:  PDFTechLib (in PDFTechLib.dll) Version: 1.0.0.0 (1.7.9.0)

Syntax

C#
public bool ExtractText(
	int beginPage,
	int EndPage,
	LayoutType layType,
	EncodingType encodingType,
	bool generateMeta,
	bool pageBreaks,
	bool ExtractImages,
	string textFileName
)
Visual Basic (Declaration)
Public Function ExtractText ( _
	beginPage As Integer, _
	EndPage As Integer, _
	layType As LayoutType, _
	encodingType As EncodingType, _
	generateMeta As Boolean, _
	pageBreaks As Boolean, _
	ExtractImages As Boolean, _
	textFileName As String _
) As Boolean
Visual C++
public:
bool ExtractText(
	int beginPage, 
	int EndPage, 
	LayoutType layType, 
	EncodingType encodingType, 
	bool generateMeta, 
	bool pageBreaks, 
	bool ExtractImages, 
	String^ textFileName
)

Parameters

beginPage
Type: System..::.Int32
Beginning page
EndPage
Type: System..::.Int32
Ending page
layType
Type: PDFTech..::.LayoutType
Text layout type.
encodingType
Type: PDFTech..::.EncodingType
Encoding for the resulting text file.
generateMeta
Type: System..::.Boolean
Flag that specifies the generation of HTML meta.
pageBreaks
Type: System..::.Boolean
Flag that specify the use of page breaks.
ExtractImages
Type: System..::.Boolean
Set this value to TRUE if you wich to extract images from the PDF document.
textFileName
Type: System..::.String
Full path of the resluting PDF document.

Return Value

Returns TRUE if function is successful

Examples

The code sample below demonstates how the text is extracted out of a PDF document.
CopyC#
using System;
using PDFTech;
namespace ExtractText
{
    class Program
    {
        static void Main(string[] args)
        {
            PDFOperation operation = new PDFOperation("C:\\sample.pdf", "");
            string Error = "";
            int pageCount = operation.GetPageCount(out Error);
            if (Error == "")
            {
                if (!operation.ExtractText(0, pageCount, LayoutType.Flowing, EncodingType.UTF8, false,
                     true, false, "C:\\sample.txt"))
                    Console.WriteLine(Error);
            }
            else
            {
                Console.WriteLine(Error);
            }
        }
    }
}

See Also