Show / Hide Table of Contents

# Namespace pdftron.Filters

### Classes

#### ASCII85Encode

ASCII85Encode filter can be used to encode any data stream into a stream that does not contain any binary characters.

#### Filter

Provides a generic view of a sequence of bytes.

A Filter is the abstract base class of all filters. A filter is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. The Filter class and its derived classes provide a generic view of these different types of input and output, isolating the programmer from the specific details of the operating system and the underlying devices.

Besides providing access to input/output sources Filters can be also to transform the data (e.g. to compress the data stream, to normalize the image data, to encrypt data, etc). Filters can also be attached to each other to form pipelines. For example, a filter used to open an image data file can be attached to a filter that decompresses the data, which is attached to another filter that will normalize the image data.

Depending on the underlying data source or repository, filters might support only some of these capabilities. An application can query a stream for its capabilities by using the IsInputFilter() and CanSeek() properties.

To read or write data to a filter, a user will typically use FilterReader/FilterWriter class. instead of using Filter methods

    MappedFile file = new MappedFile("my_stream.txt");
    FilterReader reader = new FilterReader(file);
    while (reader.read(...)) ...

#### FilterReader

FilterReader is a utility class providing a convenient way to read data from an input filter (using Filter directly is not very intuitive).

#### FilterWriter

FilterWriter is a utility class providing a convenient way to write data to an output filter (using Filter directly is not very intuitive).

#### FlateEncode

FlateEncode filter can be used to compress any data stream using Flate (i.e. ZIP) compression method.

#### MappedFile

MappedFile is a utility class to read files on a file system. Because MappedFile file is derived from pdftron.Filters.Filter you can directly chain MappedFile objects to other 'pdftron.Filters'.

MappedFile objects support random access to files using the Seek method. Seek allows the read/write position to be moved to any position within the file. This is done through a shared memory mapped chunk manager. The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three properties of the Filter.ReferencePos class. MappedFile objects are thread-safe, meaning separate copies of a MappedFile can Seek to different locations in the file, without conflicting with one another. Disk files always support random access. At the time of construction, the CanSeek() property value is set to true or false depending on the underlying file type.

#### MemoryFilter

MemoryFilter is a memory buffer that can be used as a source or a sink Filter in the Filter pipeline. When a MemoryFilter is the source, other filters can read data stored in memory; When MemoryFilter is a sink, other filters generate data which is then pushed in a memory buffer owned by MemoryFilter (MemoryFilter makes sure that there is enough space to accomodate all data).

#### StreamAdapterFilter

StreamAdapterFilter filter can be used to turn a readable System.Stream into a PDFNet Filter

### Enums

#### Filter.ReferencePos

Provides the fields that represent reference points in streams for seeking.

#### MappedFile.OpenMode

open file mode