Skip to content

PdfStream class

View as Markdown

Namespace: PdfNetStack.Objects
Assembly: PdfNetStack.dll
Package: PdfNetStack

A PDF stream: a dictionary plus encoded data. Streams are always indirect objects; add new ones with AddObject and refer to the returned reference.

public sealed class PdfStream : PdfObject

Inheritance

object ← PdfObject ← PdfStream

PdfStream(PdfDictionary, ReadOnlyMemory<byte>)

Section titled “ PdfStream(PdfDictionary, ReadOnlyMemory<byte>)”

Creates a stream from data already encoded as the dictionary’s /Filter says.

public PdfStream(PdfDictionary dictionary, ReadOnlyMemory<byte> data)

dictionary PdfDictionary

data ReadOnlyMemory<byte>

Encoded stream bytes, exactly as stored between stream and endstream. For a document opened from a stream without loading it, the bytes are read from the file on each access and not kept, until new data is assigned.

public ReadOnlyMemory<byte> Data { get; set; }

ReadOnlyMemory<byte>

The stream dictionary. /Length is written on save and need not be kept current.

public PdfDictionary Dictionary { get; }

PdfDictionary

FromData(ReadOnlySpan<byte>, PdfDictionary?, bool)

Section titled “ FromData(ReadOnlySpan<byte>, PdfDictionary?, bool)”

Creates a stream from plain data, Flate compressed unless compress is false. /Filter and /DecodeParms of dictionary are replaced to match.

public static PdfStream FromData(ReadOnlySpan<byte> data, PdfDictionary? dictionary = null, bool compress = true)

data ReadOnlySpan<byte>

dictionary PdfDictionary?

compress bool

PdfStream