[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase

Class PdfStreamWriterBase

Namespace
GrapeCity.Documents.Pdf.Writer
Assembly
GcDocs.Pdf.dll

Base class for PDF writers: GrapeCity.Documents.Pdf.Writer.PdfContentStreamWriter, PdfDocStreamWriter.

public abstract class PdfStreamWriterBase
Inheritance
object
PdfStreamWriterBase
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

Fields

Doc

The GcPdfDocument object content of which is written.

public readonly GcPdfDocument Doc

Field Value

GcPdfDocument

Properties

CurrentObjID

Gets a PdfObjID structure defining ID of PDF object currently written to the stream, used to encrypt strings. By default returns Empty.

public virtual PdfObjID CurrentObjID { get; }

Property Value

PdfObjID

Stream

Gets or sets the underlying stream.

public virtual Stream Stream { get; set; }

Property Value

System.IO.Stream

Methods

AddDictEntries(IPdfDict, params PdfName[])

Adds dictionary entries, skips entries with name in propsToSkip.

public void AddDictEntries(IPdfDict entries, params PdfName[] propsToSkip)

Parameters

entries IPdfDict
propsToSkip PdfName[]

AddDictEntries(IPdfDict, Func<PdfName, IPdfObject, bool>)

Adds dictionary entries from specified collection, PDF dictionary should be started.

public void AddDictEntries(IPdfDict values, Func<PdfName, IPdfObject, bool> propCheckCallback)

Parameters

values IPdfDict
propCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>

AddDictEntriesSkipLength(IPdfDict, Func<PdfName, IPdfObject, bool>)

Adds dictionary entries except for "Length" entry.

public void AddDictEntriesSkipLength(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)

Parameters

ipd IPdfDict
propCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>

AddDictEntriesSkipStreamProps(IPdfDict, Func<PdfName, IPdfObject, bool>)

Adds dictionary entries except for "Length", "Filter" and "DecodeParms" entries.

public void AddDictEntriesSkipStreamProps(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)

Parameters

ipd IPdfDict
propCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>

AddDictEntry(PdfName, Offsets)

Adds a dictionary entry with Offsets value.

public void AddDictEntry(PdfName key, Offsets value)

Parameters

key PdfName
value Offsets

AddDictEntry(PdfName, PdfDateTime)

Adds a dictionary entry with PdfDateTime value.

public void AddDictEntry(PdfName key, PdfDateTime value)

Parameters

key PdfName
value PdfDateTime

AddDictEntry(PdfName, IPdfObject)

Adds a dictionary entry with value representing GrapeCity.Documents.Pdf.Spec.IPdfObject, see Write(IPdfObject).

public abstract void AddDictEntry(PdfName key, IPdfObject value)

Parameters

key PdfName
value GrapeCity.Documents.Pdf.Spec.IPdfObject

AddDictEntry(PdfName, bool, bool)

Adds a dictionary entry with bool value.

public void AddDictEntry(PdfName key, bool value, bool defValue)

Parameters

key PdfName
value bool
defValue bool

AddDictEntry(PdfName, bool)

Adds a dictionary entry with PDF bool value.

public void AddDictEntry(PdfName key, bool value)

Parameters

key PdfName
value bool

AddDictEntry(PdfName, IList<PointF>, Func<PointF, PointF>)

Adds a dictionary entry with array of points. convertMethod is called for each item in value.

public void AddDictEntry(PdfName key, IList<PointF> value, Func<PointF, PointF> convertMethod)

Parameters

key PdfName
value System.Collections.Generic.IList<T><System.Drawing.PointF>
convertMethod System.Func<T, TResult><System.Drawing.PointF, System.Drawing.PointF>

AddDictEntry(PdfName, IList<int>, IList<int>)

Adds a dictionary entry with integer array value.

public void AddDictEntry(PdfName key, IList<int> value, IList<int> defValue = null)

Parameters

key PdfName
value System.Collections.Generic.IList<T><int>
defValue System.Collections.Generic.IList<T><int>

AddDictEntry(PdfName, IList<float>, IList<float>)

Adds a dictionary entry with float array value.

public void AddDictEntry(PdfName key, IList<float> value, IList<float> defValue = null)

Parameters

key PdfName
value System.Collections.Generic.IList<T><float>
defValue System.Collections.Generic.IList<T><float>

AddDictEntry(PdfName, double)

Adds a dictionary entry with double value.

public void AddDictEntry(PdfName key, double value)

Parameters

key PdfName
value double

AddDictEntry(PdfName, Color)

Adds a dictionary entry with System.Drawing.Color value.

public void AddDictEntry(PdfName key, Color value)

Parameters

key PdfName
value System.Drawing.Color

AddDictEntry(PdfName, RectangleF)

Adds a dictionary entry with System.Drawing.RectangleF value.

public void AddDictEntry(PdfName key, RectangleF value)

Parameters

key PdfName
value System.Drawing.RectangleF

AddDictEntry(PdfName, int, int)

Adds a dictionary entry with integer value.

public void AddDictEntry(PdfName key, int value, int defValue)

Parameters

key PdfName
value int
defValue int

AddDictEntry(PdfName, int)

Adds a dictionary entry with integer value.

public void AddDictEntry(PdfName key, int value)

Parameters

key PdfName
value int

AddDictEntry(PdfName, long)

Adds a dictionary entry with integer value.

public void AddDictEntry(PdfName key, long value)

Parameters

key PdfName
value long

AddDictEntry(PdfName, Offsets?)

Adds a dictionary entry with nullable Offsets value.

public void AddDictEntry(PdfName key, Offsets? value)

Parameters

key PdfName
value Offsets?

AddDictEntry(PdfName, PdfDateTime?)

Adds a dictionary entry with nullable PdfDateTime value.

public void AddDictEntry(PdfName key, PdfDateTime? value)

Parameters

key PdfName
value PdfDateTime?

AddDictEntry(PdfName, bool?)

Adds a dictionary entry with nullable bool value.

public void AddDictEntry(PdfName key, bool? value)

Parameters

key PdfName
value bool?

AddDictEntry(PdfName, RectangleF?, RectangleF)

Adds a dictionary entry with nullable System.Drawing.RectangleF value.

public void AddDictEntry(PdfName key, RectangleF? value, RectangleF defValue)

Parameters

key PdfName
value System.Drawing.RectangleF?
defValue System.Drawing.RectangleF

AddDictEntry(PdfName, RectangleF?)

Adds a dictionary entry with nullable System.Drawing.RectangleF value.

public void AddDictEntry(PdfName key, RectangleF? value)

Parameters

key PdfName
value System.Drawing.RectangleF?

AddDictEntry(PdfName, int?)

Adds a dictionary entry with nullable integer value.

public void AddDictEntry(PdfName key, int? value)

Parameters

key PdfName
value int?

AddDictEntry(PdfName, float?, float)

Adds a dictionary entry with nullable float value.

public void AddDictEntry(PdfName key, float? value, float defValue)

Parameters

key PdfName
value float?
defValue float

AddDictEntry(PdfName, float?)

Adds a dictionary entry with nullable float value.

public void AddDictEntry(PdfName key, float? value)

Parameters

key PdfName
value float?

AddDictEntry(PdfName, Matrix3x2)

Adds a dictionary entry with System.Numerics.Matrix3x2 value.

public void AddDictEntry(PdfName key, Matrix3x2 value)

Parameters

key PdfName
value System.Numerics.Matrix3x2

AddDictEntry(PdfName, float)

Adds a dictionary entry with float value.

public void AddDictEntry(PdfName key, float value)

Parameters

key PdfName
value float

AddDictEntry(PdfName, float[], float)

Adds a dictionary entry with line style value.

public void AddDictEntry(PdfName key, float[] dashPattern, float dashPhase)

Parameters

key PdfName
dashPattern float[]
dashPhase float

AddDictEntry<TEnum>(PdfName, PdfEnum<TEnum>)

Adds a dictionary entry with PdfEnum<TEnum> value.

public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum> value) where TEnum : struct

Parameters

key PdfName
value PdfEnum<TEnum>

Type Parameters

TEnum

AddDictEntry<T>(PdfName, T?, T)

Adds a dictionary entry with PDF name value, the PDF name obtained as value.ToString().

public void AddDictEntry<T>(PdfName key, T? value, T defValue) where T : struct

Parameters

key PdfName
value T?
defValue T

Type Parameters

T

AddDictEntry<TEnum>(PdfName, PdfEnum<TEnum>?)

Adds a dictionary entry with nullable PdfEnum<TEnum> value.

public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum>? value) where TEnum : struct

Parameters

key PdfName
value PdfEnum<TEnum>?

Type Parameters

TEnum

AddDictEntryArray(PdfName, params IPdfObject[])

Adds a dictionary entry with PDF array value, does nothing if value is null, writes empty PDF array if value has no items.

public void AddDictEntryArray(PdfName key, params IPdfObject[] value)

Parameters

key PdfName
value GrapeCity.Documents.Pdf.Spec.IPdfObject[]

AddDictEntryHexString(PdfName, IList<byte>)

Adds a dictionary entry with PDF string value written as HEX string: <F1A0>

public void AddDictEntryHexString(PdfName key, IList<byte> value)

Parameters

key PdfName
value System.Collections.Generic.IList<T><byte>

AddDictEntryName(PdfName, string)

Adds a dictionary entry with PDF name value, the entry is added only if value is not null and not empty.

public void AddDictEntryName(PdfName key, string value)

Parameters

key PdfName
value string

AddDictEntryNameArray(PdfName, params string[])

Adds a dictionary entry with PDF name array.

public void AddDictEntryNameArray(PdfName key, params string[] value)

Parameters

key PdfName
value string[]

AddDictEntryNames(PdfName, string[], string[])

Adds a dictionary entry with PDF name array.

public void AddDictEntryNames(PdfName key, string[] value, string[] defValue = null)

Parameters

key PdfName
value string[]
defValue string[]

AddDictEntryObjRef(PdfName, PdfObjID)

Adds a dictionary entry with PDF reference.

public void AddDictEntryObjRef(PdfName key, PdfObjID objID)

Parameters

key PdfName
objID PdfObjID

AddDictEntryObjRef(PdfName, int)

Adds a dictionary entry with PDF reference.

public void AddDictEntryObjRef(PdfName key, int objID)

Parameters

key PdfName
objID int

AddDictEntryPlaceHolder(PdfName, int, out long)

Adds a dictionary entry with "placeholder" (spaces) the actual value should be written later, used when generating linearized PDF stream.

public void AddDictEntryPlaceHolder(PdfName key, int placeHolderLength, out long placeHolderOffset)

Parameters

key PdfName
placeHolderLength int
placeHolderOffset long

AddDictEntryRichString(PdfName, string)

Adds a dictionary entry with PDF rich string value, see PDF specification for details about Rich text in PDF.

public void AddDictEntryRichString(PdfName key, string value)

Parameters

key PdfName
value string

AddDictEntryString(PdfName, IList<byte>, bool)

Adds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.

public void AddDictEntryString(PdfName key, IList<byte> value, bool encrypt = true)

Parameters

key PdfName
value System.Collections.Generic.IList<T><byte>
encrypt bool

AddDictEntryString(PdfName, IList<byte>)

Adds string dict entry, string is written as PDF string i.e. like (BlaBla). If string contains chars with code greater than 126 it encoded as unicode. String is encoded if encoding specified for document.

public void AddDictEntryString(PdfName key, IList<byte> value)

Parameters

key PdfName
value System.Collections.Generic.IList<T><byte>

AddDictEntryString(PdfName, string)

Adds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.

public void AddDictEntryString(PdfName key, string value)

Parameters

key PdfName
value string

AddDictEntryStringNotEmpty(PdfName, string)

Adds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.

public void AddDictEntryStringNotEmpty(PdfName key, string value)

Parameters

key PdfName
value string

BeginArray()

Starts a PDF array, should be enclosed with EndArray().

public void BeginArray()

BeginArrayEntry(PdfName)

Starts a PDF dictionary entry with array value, should be enclosed with EndArrayEntry().

public void BeginArrayEntry(PdfName propName)

Parameters

propName PdfName

BeginDict()

Starts a PDF dictionary, should be enclosed with EndDict().

public void BeginDict()

BeginDictEntry(PdfName)

Starts a PDF dictionary entry with nested dictionary value, should be enclosed with EndDictEntry().

public void BeginDictEntry(PdfName propName)

Parameters

propName PdfName

BeginEntry(PdfName)

Starts a PDF dictionary entry, should be enclosed with EndEntry().

public void BeginEntry(PdfName propName)

Parameters

propName PdfName

EndArray()

Ends a PDF array started with BeginArray().

public void EndArray()

EndArrayEntry()

Ends a PDF dictionary entry started with BeginArrayEntry(PdfName).

public void EndArrayEntry()

EndDict()

Ends a PDF dictionary started with BeginDict().

public void EndDict()

EndDictEntry()

Ends a PDF dictionary entry started with BeginDictEntry(PdfName).

public void EndDictEntry()

EndEntry()

Ends a PDF dictionary entry started with BeginEntry(PdfName).

public void EndEntry()

Flush()

Flushes all data to the underlying stream.

public void Flush()

FmtDouble(double)

Converts specified float to string which can be written to PDF stream.

public static string FmtDouble(double value)

Parameters

value double

Returns

string

FmtDouble(float)

Converts specified float to string which can be written to PDF stream.

public static string FmtDouble(float value)

Parameters

value float

Returns

string

FmtInteger(int)

Converts specified integer to string which can be written to PDF stream.

public static string FmtInteger(int value)

Parameters

value int

Returns

string

FmtLong(long)

Converts specified long to string which can be written to PDF stream.

public static string FmtLong(long value)

Parameters

value long

Returns

string

FmtUint(uint)

Converts specified uint to string which can be written to PDF stream.

public static string FmtUint(uint value)

Parameters

value uint

Returns

string

GetPosition()

For internal use only. Gets the Position on the underlying stream.

public long GetPosition()

Returns

long

Seek(long, SeekOrigin)

Sets the position within the underlying stream.

public void Seek(long offset, SeekOrigin origin)

Parameters

offset long
origin System.IO.SeekOrigin

Write(IPdfObject)

Writes the GrapeCity.Documents.Pdf.Spec.IPdfObject object if value is indirect object then reference to this object will be written otherwise GrapeCity.Documents.Pdf.Spec.IPdfObject.Write(GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase) will be called to write value representing an object. If value is null or GrapeCity.Documents.Pdf.Spec.IPdfObject.Empty is true then PDF NULL value will be written.

public abstract void Write(IPdfObject value)

Parameters

value GrapeCity.Documents.Pdf.Spec.IPdfObject

Write(byte[])

Writes a byte array.

public void Write(byte[] value)

Parameters

value byte[]

Write(PointF)

Writes a System.Drawing.PointF structure as 2 float values.

public void Write(PointF p)

Parameters

p System.Drawing.PointF

Write(Stream)

Writes content of specified stream.

public void Write(Stream stream)

Parameters

stream System.IO.Stream

Write(Matrix3x2)

Writes a System.Numerics.Matrix3x2 structure.

public void Write(Matrix3x2 value)

Parameters

value System.Numerics.Matrix3x2

Write(string, int)

Writes a string using ASCII encoding, each char converted to byte as (byte)s[i]. If string length is less than length the spaces will be added at right, if string length is greater than length the string will be truncated.

public void Write(string value, int length)

Parameters

value string
length int

Write(string)

Writes a string using ASCII encoding, each char converted to byte as (byte)s[i].

public void Write(string value)

Parameters

value string

WriteBool(bool)

Writes a bool value.

public void WriteBool(bool value)

Parameters

value bool

WriteByte(byte)

Writes a single byte.

public void WriteByte(byte value)

Parameters

value byte

WriteBytes(byte, int)

Writes specified count of bytes to the stream.

public void WriteBytes(byte b, int count)

Parameters

b byte
count int

WriteColor(Color)

Writes a System.Drawing.Color value as sequence of 3 numbers R, G, B. NOTE! alpha channel is NOT written.

public void WriteColor(Color value)

Parameters

value System.Drawing.Color

WriteCRLF()

Writes the CRLF, resets GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter.

public void WriteCRLF()

WriteDelim()

Writes the (space) if GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter is true, resets GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter.

public void WriteDelim()

WriteDouble(double, int)

Writes a double value.

public void WriteDouble(double value, int decimalPlaces = -1)

Parameters

value double
decimalPlaces int

WriteFloat(float?, int)

Writes a nullable float value.

public void WriteFloat(float? value, int decimalPlaces = -1)

Parameters

value float?
decimalPlaces int

WriteFloat(float, int)

Writes a float value.

public void WriteFloat(float value, int decimalPlaces = -1)

Parameters

value float
decimalPlaces int

WriteFloatArray(float[], int)

Writes a float array, writes a null if value is null.

public void WriteFloatArray(float[] value, int decimalPlaces = -1)

Parameters

value float[]
decimalPlaces int

WriteHexString(IList<byte>, bool)

Writes a string as PDF HEX string, like <FF01>. Note! String is encrypted if encrypt is true and encryption is specified for the document. Note! If value is null or empty then empty '()' PDF string is written.

public void WriteHexString(IList<byte> value, bool encrypt = true)

Parameters

value System.Collections.Generic.IList<T><byte>
encrypt bool

WriteInt(int)

Writes an integer value.

public void WriteInt(int value)

Parameters

value int

WriteIntValue(int)

Writes an integer value.

public void WriteIntValue(int value)

Parameters

value int

WriteLine(string)

Writes a string and adds CRLF after, each char of the string converted to a byte.

public void WriteLine(string s)

Parameters

s string

WriteLong(long)

Writes a long value.

public void WriteLong(long value)

Parameters

value long

WriteLongValue(long)

Writes a long value.

public void WriteLongValue(long value)

Parameters

value long

WriteName(PdfName)

Writes a PDF name value, like "/name".

public void WriteName(PdfName value)

Parameters

value PdfName

WriteName(IList<byte>)

Writes a byte array as PDF name value, i.e. like "/name".

public void WriteName(IList<byte> value)

Parameters

value System.Collections.Generic.IList<T><byte>

WriteName(string)

Writes a string as PDF name value, like "/name".

public void WriteName(string value)

Parameters

value string

WriteNull()

Writes a NULL value.

public void WriteNull()

WriteOffsets(Offsets)

Writes an Offsets structure as 4 float values.

public void WriteOffsets(Offsets value)

Parameters

value Offsets

WritePdfDateTime(PdfDateTime)

Writes a PdfDateTime value, the value is encoded as it defined in chapter 3.8.3 Dates of PdfSpec 1.7.

public void WritePdfDateTime(PdfDateTime value)

Parameters

value PdfDateTime

WritePlaceHolder(int, out long)

Writes a placeholder to the PDF stream and returns its offset.

public void WritePlaceHolder(int placeHolderLength, out long placeHolderOffset)

Parameters

placeHolderLength int
placeHolderOffset long

WriteRect(RectangleF)

Writes a System.Drawing.RectangleF structure as 4 float values Left, Top, Width, Height.

public void WriteRect(RectangleF value)

Parameters

value System.Drawing.RectangleF

WriteRectLTRB(RectangleF)

Writes a System.Drawing.RectangleF structure as 4 float values Left, Top, Right, Bottom.

public void WriteRectLTRB(RectangleF value)

Parameters

value System.Drawing.RectangleF

WriteRef(PdfObjID)

Writes a PDF reference like "10 0 R".

public virtual void WriteRef(PdfObjID objID)

Parameters

objID PdfObjID

WriteRef(int)

Writes a PDF reference like "10 0 R".

public void WriteRef(int objID)

Parameters

objID int

WriteString(IList<byte>, bool)

Writes a byte array as PDF string, like "(BlaBla)". Note! String is encrypted if encrypt is true and encryption is specified for the document. Note! If value is null or empty then empty "()" PDF string is written.

public void WriteString(IList<byte> value, bool encrypt = true)

Parameters

value System.Collections.Generic.IList<T><byte>
encrypt bool

WriteString(string, bool)

Writes a string as PDF string, like "(BlaBla)". Note! String is encrypted if encrypt is true and encryption is specified for the document. Note! If value is null or empty then empty "()" PDF string is written.

public void WriteString(string value, bool encrypt = true)

Parameters

value string
encrypt bool

WriteUint(uint)

Writes an uint value.

public void WriteUint(uint value)

Parameters

value uint