Skip to content

# PDFCosStream

Namespace: O2S.Components.PDF4NET.Core.Cos

Defines a PDF COS stream.

    public class PDFCosStream : PDFCosDictionaryContainer, IPDFCosObjectContainer

Inheritance Object → PDFCosObject → PDFCosDictionary → PDFCosDictionaryContainer → PDFCosStream
Implements IPDFCosObjectContainer

## Constructors

### PDFCosStream()

Initializes a new PDFCosStream object.

    public PDFCosStream()

## Properties

### Count

Gets the number of key/value pairs contained in the Dictionary.

    public int Count { get; }

Property Value

Int32

### DecodedStream

Gets the decoded stream.

    public PDFStream DecodedStream { get; }

Property Value

PDFStream
The decompressed content of the stream.

Remarks

This stream should be treated as read only as writing content to it will have no effect on the COS stream object.

### FileOffset

Gets the object's file offset.

    public long FileOffset { get; internal set; }

Property Value

Int64
The offset of the object from the start of the PDF file.

Remarks

If the object is newly created and it is not loaded from a file, this property is 0.

### Item

    public PDFCosObject Item { get; set; }

Property Value

PDFCosObject

### Item

    public PDFCosObject Item { get; set; }

Property Value

PDFCosObject

### Keys

Gets a collection containing the keys in the Dictionary.

    public String[] Keys { get; }

Property Value

String[]
A string array containing the keys in the Dictionary.

### OriginalObjectNumber

Gets the original object number.

    public long OriginalObjectNumber { get; internal set; }

Property Value

Int64
The object number in the source PDF file.

Remarks

If the object is newly created and it is not loaded from a file, this property is 0.

### Stream

Gets or sets the stream content.

    public Byte[] Stream { get; set; }

Property Value

Byte[]
The stream content.

### Type

Gets the object type.

    public PDFCosObjectType Type { get; }

Property Value

PDFCosObjectType

## Methods

### SetStreamContent(Stream, PDFFilterType)

Sets the COS stream content with the specified stream.

    public void SetStreamContent(Stream sourceStream, PDFFilterType pdfFilter)

Parameters

`sourceStream` Stream
Source stream for content

`pdfFilter` PDFFilterType
Type of compression to apply to stream content

Exceptions

ArgumentNullException
Thrown when sourceStream is null

### ToString()

Returns a String that represents the current Object.

    public string ToString()

Returns

String
String that represents the current Object.