Filter Classes

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

    See more

    Declaration

    Objective-C

    @interface PTASCII85Encode : PTFilter

    Swift

    class PTASCII85Encode : PTFilter
  • 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.

    Note

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

    For example:

     StdFile file("my_stream.txt", StdFile::e_read_mode);
     FilterReader reader(file);
     while (reader.Read(..)) ...
    
    See more

    Declaration

    Objective-C

    @interface PTFilter : NSObject

    Swift

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

    For example:

     StdFile file("my_stream.txt", StdFile::e_read_mode);
     FilterReader reader(file);
     while (reader.Read(...)) ...
    
    See more

    Declaration

    Objective-C

    @interface PTFilterReader : NSObject

    Swift

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

    For example:

     StdFile outfile("file.dat", StdFile::e_write_mode);
     FilterWriter fwriter(outfile);
     fwriter.WriteBuffer(buf, buf_sz);
     fwriter.Flush();
    
    See more

    Declaration

    Objective-C

    @interface PTFilterWriter : NSObject

    Swift

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

    See more

    Declaration

    Objective-C

    @interface PTFlateEncode : PTFilter

    Swift

    class PTFlateEncode : PTFilter
  • 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.

    Note

    .NET or Java applications should explicitly Close() files when they are not needed. If the files are not closed or disposed this may lead to the resource exhaustion.
    See more

    Declaration

    Objective-C

    @interface PTMappedFile : PTFilter

    Swift

    class PTMappedFile : PTFilter