C# Class PDFCompress, temona.Iot.study

This is an ad-hoc class to compress PDF stream. Currently this class compresses binary (byte) stream using RLE which PDF 1.3 specification has thus formulated: The RunLengthDecode filter decodes data that has been encoded in a simple byte-oriented format based on run length. The encoded data is a sequence of runs, where each run consists of a length byte followed by 1 to 128 bytes of data. If the length byte is in the range 0 to 127, the following length + 1 (1 to 128) bytes are copied literally during decompression. If length is in the range 129 to 255, the following single byte is to be copied 257 - length (2 to 128) times during decompression. A length value of 128 denotes EOD. The chart image compression ratio comes to around 10:3
ファイルを表示 Open project: TEMONA/temona.Iot.study

Public Methods

Method Description
PDFCompress ( byte UnCompressed ) : System

Takes the uncompressed byte array

RLECompress ( ) : byte[]

compresses uncompressed data to compressed data in byte array

Private Methods

Method Description
WriteNoRepeater ( MemoryStream NoRepeatBytes ) : void
WriteRunLength ( int length, byte encodee ) : int

Write compressed data as RunLength

Method Details

PDFCompress() public method

Takes the uncompressed byte array
public PDFCompress ( byte UnCompressed ) : System
UnCompressed byte uncompressed data
return System

RLECompress() public method

compresses uncompressed data to compressed data in byte array
public RLECompress ( ) : byte[]
return byte[]