Table of Contents

Class PdfStream

Namespace
iTextSharp.text.pdf
Assembly
iTextSharp.LGPLv2.Core.dll

PdfStream is the Pdf stream object. A stream, like a string, is a sequence of characters. However, an application can read a small portion of a stream at a time, while a string must be read in its entirety. For this reason, objects with potentially large amounts of data, such as images and page descriptions, are represented as streams. A stream consists of a dictionary that describes a sequence of characters, followed by the keyword stream, followed by zero or more lines of characters, followed by the keyword endstream. All streams must be PdfIndirectObject s. The stream dictionary must be a direct object. The keyword stream that follows the stream dictionary should be followed by a carriage return and linefeed or just a linefeed. Remark: In this version only the FLATEDECODE-filter is supported. This object is described in the 'Portable Document Format Reference Manual version 1.3' section 4.8 (page 41-53). @see PdfObject @see PdfDictionary

public class PdfStream : PdfDictionary
Inheritance
PdfStream
Derived
Inherited Members

Constructors

PdfStream()

Constructs a PdfStream -object.

protected PdfStream()

PdfStream(byte[])

Constructs a PdfStream -object.

public PdfStream(byte[] bytes)

Parameters

bytes byte[]

content of the new PdfObject as an array of byte .

PdfStream(Stream, PdfWriter)

Creates an efficient stream. No temporary array is ever created. The InputStream is totally consumed but is not closed. The general usage is: InputStream in = ...; PdfStream stream = new PdfStream(in, writer); stream.FlateCompress(); writer.AddToBody(stream); stream.WriteLength(); in.Close();

public PdfStream(Stream inputStream, PdfWriter writer)

Parameters

inputStream Stream

the data to write to this stream

writer PdfWriter

the PdfWriter for this stream

Fields

BEST_COMPRESSION

membervariables

public const int BEST_COMPRESSION = 9

Field Value

int

BEST_SPEED

A possible compression level. @since 2.1.3

public const int BEST_SPEED = 1

Field Value

int

Compressed

is the stream compressed?

protected bool Compressed

Field Value

bool

CompressionLevel

The level of compression. @since 2.1.3

protected int CompressionLevel

Field Value

int

DEFAULT_COMPRESSION

A possible compression level. @since 2.1.3

public const int DEFAULT_COMPRESSION = -1

Field Value

int

InputStream

protected Stream InputStream

Field Value

Stream

InputStreamLength

protected int InputStreamLength

Field Value

int

Iref

protected PdfIndirectReference Iref

Field Value

PdfIndirectReference

NO_COMPRESSION

A possible compression level. @since 2.1.3

public const int NO_COMPRESSION = 0

Field Value

int

StreamBytes

protected MemoryStream StreamBytes

Field Value

MemoryStream

Writer

protected PdfWriter Writer

Field Value

PdfWriter

rawLength

protected int rawLength

Field Value

int

Properties

RawLength

methods overriding some methods of PdfObject

public int RawLength { get; }

Property Value

int

Methods

FlateCompress()

Compresses the stream.

public void FlateCompress()

FlateCompress(int)

methods

public void FlateCompress(int compressionLevel)

Parameters

compressionLevel int

the compression level (0 = best speed, 9 = best compression, -1 is default)

SuperToPdf(PdfWriter, Stream)

protected virtual void SuperToPdf(PdfWriter writer, Stream os)

Parameters

writer PdfWriter
os Stream

ToPdf(PdfWriter, Stream)

public override void ToPdf(PdfWriter writer, Stream os)

Parameters

writer PdfWriter
os Stream

ToString()

@see com.lowagie.text.pdf.PdfObject#toString()

public override string ToString()

Returns

string

WriteContent(Stream)

Writes the data content to an Stream . @throws IOException on error

public void WriteContent(Stream os)

Parameters

os Stream

the destination to write to

WriteLength()

Writes the stream length to the PdfWriter . This method must be called and can only be called if the contructor {@link #PdfStream(InputStream,PdfWriter)} is used to create the stream. @throws IOException on error @see #PdfStream(InputStream,PdfWriter)

public void WriteLength()