TextDevice

Overview

TextDevice is a class in Aspose.Pdf FOSS for Java.

Extracts text from a PDF page and writes it to an output stream.

Properties

NameTypeAccessDescription
extractionOptionsTextExtractionOptionsReadReturns the current extraction options.
encodingCharsetReadReturns the current output encoding.
DEFAULT_ENCODINGCharsetRead{@link Charset} matching .NET {@code Encoding.Unicode} (UTF-16 little-endian, no BOM).

Methods

SignatureDescription
TextDevice()Creates a TextDevice with default options ({@code Pure} mode) and Unicode encoding.
TextDevice(encoding: Charset)Creates a TextDevice with the given encoding and default options ({@code Pure} mode).
TextDevice(options: TextExtractionOptions)Creates a TextDevice with the given options and default Unicode encoding.
TextDevice(options: TextExtractionOptions, encoding: Charset)Creates a TextDevice with the given options and encoding.
getExtractionOptions()TextExtractionOptionsReturns the current extraction options.
setExtractionOptions(options: TextExtractionOptions)Sets the extraction options (null is replaced with the default {@code Pure} options).
getEncoding()CharsetReturns the current output encoding.
setEncoding(encoding: Charset)Sets the output encoding (null is replaced with the default Unicode/UTF-16LE).
process(page: Page, output: OutputStream)Extracts text from a page and writes it to the output stream using the
configured encoding.
process(page: Page, outputFile: String)Extracts text from a page and writes it to the file at {@code outputFile}
using the configured encoding.

See Also