Click or drag to resize
Pdftools logo

ExtractorExtractText Method

Extract text from a PDF document


Namespace: PdfTools.Extraction
Assembly: PdfTools (in PdfTools.dll) Version: 1.13.1+c1edd0fb6162605291bc60916112af48eb301945
Syntax
C#
public void ExtractText(
	Document inDoc,
	Stream outStream,
	TextOptions options = null,
	int? firstPage = null,
	int? lastPage = null
)

Parameters

inDoc  Document
The input PDF document.
outStream  Stream
The stream to which output file the extracted text is written.
options  TextOptions  (Optional)
The option object that controls the text extraction.
firstPage  NullableInt32  (Optional)

Optional parameter denoting the index of the first page to be copied. This index is one-based. If set, the number must be in the range of 1 (first page) to PageCount (last page).

If not set, 1 is used.

lastPage  NullableInt32  (Optional)

Optional parameter denoting the index of the last page to be copied. This index is one-based. If set, the number must be in the range of 1 (first page) to PageCount (last page).

If not set, PageCount is used.

Exceptions
ExceptionCondition
LicenseExceptionThe license check has failed.
ProcessingExceptionThe processing has failed.
IOExceptionWriting to the output text file has failed.
GenericExceptionA generic error occurred.
ArgumentExceptionThe firstPage or lastPage are not in the allowed range.
ArgumentNullExceptionif inDoc is .
ArgumentNullExceptionif outStream is .
See Also