Table of Contents

Class PdfStream

Namespace
MiPdf.Objects
Assembly
MiPdf.dll

A PDF stream: a dictionary plus a byte sequence. RawBytes holds the encoded data as stored in the file (after decryption); GetBytes() applies the decoding filters. Streams must be indirect objects; the writer allocates an object number for direct streams.

public sealed class PdfStream : PdfDictionary, IEnumerable<KeyValuePair<PdfName, PdfObject>>, IEnumerable
Inheritance
PdfStream
Implements
Inherited Members

Constructors

PdfStream()

Creates an empty stream without data.

public PdfStream()

PdfStream(byte[], bool)

Creates a stream from decoded data, optionally Flate-compressing it.

public PdfStream(byte[] data, bool compress = true)

Parameters

data byte[]
compress bool

Properties

ObjectType

The kind of this object.

public override PdfObjectType ObjectType { get; }

Property Value

PdfObjectType

RawBytes

The encoded stream data.

public byte[] RawBytes { get; }

Property Value

byte[]

Methods

Clone()

Creates a deep copy of the dictionary entries and a copy of the encoded data.

public override PdfObject Clone()

Returns

PdfObject

GetBytes()

Returns the decoded data. Image-specific filters (DCT, JPX, JBIG2, CCITT) are not decoded; data encoded with those is returned as-is after all preceding generic filters.

public byte[] GetBytes()

Returns

byte[]

GetFilters()

Returns the filter names in order of application.

public IReadOnlyList<PdfName> GetFilters()

Returns

IReadOnlyList<PdfName>

SetBytes(byte[], bool)

Replaces the stream data; with compress the data is Flate-encoded.

public void SetBytes(byte[] data, bool compress = true)

Parameters

data byte[]
compress bool

SetRawBytes(byte[])

Replaces the encoded data; the /Filter and /DecodeParms entries are left untouched.

public void SetRawBytes(byte[] raw)

Parameters

raw byte[]