[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Spec.IPdfDictExt

Class IPdfDictExt

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

Contains extension methods for the IPdfDict interface, allows working with PdfDict and PdfDictObject in the same way.

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

Methods

Clear(IPdfDict)

Clears the dictionary.

public static bool Clear(this IPdfDict dict)

Parameters

dict IPdfDict

The current dictionary.

Returns

bool

ContainsKey(IPdfDict, PdfName)

Determines whether this IPdfDict contains the specified key.

public static bool ContainsKey(this IPdfDict dict, PdfName key)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key to check.

Returns

bool

true if this IPdfDict contains an element with the specified key, false otherwise.

CopyToExcluding(IPdfDict, ref PdfDict, HashSet<PdfName>)

Copies from the current dictionary to dest all properties except those specified in propsToExclude.

dest can be null, in that case it will be initialized if there are any properties to copy.

public static void CopyToExcluding(this IPdfDict dict, ref PdfDict dest, HashSet<PdfName> propsToExclude)

Parameters

dict IPdfDict

The current dictionary.

dest PdfDict

The PdfDict object (can be null).

propsToExclude System.Collections.Generic.HashSet<T><PdfName>

The names of properties to exclude.

Count(IPdfDict)

Gets the count of items in the IPdfDict.

public static int Count(this IPdfDict dict)

Parameters

dict IPdfDict

The current dictionary.

Returns

int

DictToString(IPdfDict)

Converts the IPdfDict to a string.

public static string DictToString(IPdfDict dict)

Parameters

dict IPdfDict

The IPdfDict.

Returns

string

Get<T>(IPdfDict, PdfName, T)

Gets the value associated with the specified key, if the value does not exist or cannot be converted to a T returns the defValue. Note! This method returns IPdfRef if T is IPdfRef, otherwise the method resolves the reference and returns actual object.

public static T Get<T>(this IPdfDict dict, PdfName key, T defValue) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue T

The default value.

Returns

T

The value associated with the specified key, or null

Type Parameters

T

Get<T>(IPdfDict, PdfName, bool)

Gets the value associated with the specified key, if the value does not exist or cannot be converted to a T returns null. Note! This method returns IPdfRef if T is IPdfRef, otherwise the method resolves the reference and returns actual object.

public static T Get<T>(this IPdfDict dict, PdfName key, bool addWarning = true) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

addWarning bool

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if errors occur.

Returns

T

The value associated with the specified key, or null

Type Parameters

T

GetArray<T>(IPdfDict, PdfName, bool)

Gets the array of T objects associated with the specified key. Returns null if the array does not exist or cannot be converted to an array of T.

public static T[] GetArray<T>(this IPdfDict dict, PdfName key, bool singleToArray = false) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the array.

singleToArray bool

Indicates whether to convert a single T value to an array.

Returns

T[]

The array associated with the specified key, or null.

Type Parameters

T

GetAtPath<T>(IPdfDict, params object[])

Gets the value at the specified path. The path can contain IPdfName objects which are interpreted as dictionary keys, or integers which are interpreted as IPdfArray indices.

public static T GetAtPath<T>(this IPdfDict dict, params object[] path) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

path object[]

The path to the value.

Returns

T

The value associated with the specified path, or null if the value could not be found.

Type Parameters

T

GetBool(IPdfDict, PdfName, bool)

Gets the Boolean value associated with the specified key. If the value does not exist or cannot be converted to a Boolean, returns defValue (which can be null).

public static bool GetBool(this IPdfDict dict, PdfName key, bool defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue bool

The default value.

Returns

bool

The value associated with the specified key, or null.

GetBool(IPdfDict, PdfName, bool?)

Gets the nullable Boolean value associated with the specified key. If the value does not exist or cannot be converted to a Boolean, returns defValue (which can be null).

public static bool? GetBool(this IPdfDict dict, PdfName key, bool? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue bool?

The default value.

Returns

bool?

The value associated with the specified key, or null.

GetBoolArray(IPdfDict, PdfName, bool)

Gets the Boolean array associated with the specified key. Returns null if the array does not exist or cannot be converted to a Boolean array.

public static bool[] GetBoolArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single Boolean value to an array.

Returns

bool[]

The array associated with the specified key, or null.

GetColor(IPdfDict, PdfName, Color)

Gets the System.Drawing.Color associated with the specified key (in a PDF a System.Drawing.Color should be represented as an array of 1, 3 or 4 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Drawing.Color.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Drawing.Color.
public static Color GetColor(this IPdfDict dict, PdfName key, Color defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Drawing.Color

The default value.

Returns

System.Drawing.Color

The value associated with the specified key.

GetColor(IPdfDict, PdfName, Color?)

Gets the System.Drawing.Color associated with the specified key (in a PDF a System.Drawing.Color should be represented as an array of 1, 3 or 4 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Drawing.Color.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Drawing.Color.
public static Color? GetColor(this IPdfDict dict, PdfName key, Color? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Drawing.Color?

The default value.

Returns

System.Drawing.Color?

The value associated with the specified key.

GetDeviceRGBColor(IPdfDict, PdfName, Color)

Gets the RGB System.Drawing.Color associated with the specified key (in a PDF an RGB System.Drawing.Color should be represented as an array of 3 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Drawing.Color.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Drawing.Color.
public static Color GetDeviceRGBColor(this IPdfDict dict, PdfName key, Color defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Drawing.Color

The default value.

Returns

System.Drawing.Color

The value associated with the specified key.

GetDictArray(IPdfDict, PdfName, bool)

Gets the IPdfDict array associated with the specified key. Returns null if the array does not exist or cannot be converted to an IPdfDict array.

public static IPdfDict[] GetDictArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single IPdfDict to an array.

Returns

IPdfDict[]

The array associated with the specified key, or null.

GetDouble(IPdfDict, PdfName, double?)

Gets the nullable Double value associated with the specified key. If the value does not exist or cannot be converted to a Double, returns defValue (which can be null).

public static double? GetDouble(this IPdfDict dict, PdfName key, double? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue double?

The default value.

Returns

double?

The value associated with the specified key, or defValue.

GetEnum<T>(IPdfDict, PdfName, T)

Gets the enum value associated with the specified key. If the value does not exist or cannot be converted to an enum, returns defValue.

public static T GetEnum<T>(this IPdfDict dict, PdfName key, T defValue) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue T

The default value.

Returns

T

The value associated with the specified key, or defValue.

Type Parameters

T

GetEnum<T>(IPdfDict, PdfName, T?)

Gets the nullable enum value associated with the specified key. If the value does not exist or cannot be converted to an enum, returns defValue (which can be null).

public static T? GetEnum<T>(this IPdfDict dict, PdfName key, T? defValue) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue T?

The default value.

Returns

T?

The value associated with the specified key, or defValue.

Type Parameters

T

GetFloat(IPdfDict, PdfName, float?)

Gets the nullable Float value associated with the specified key. If the value does not exist or cannot be converted to a Float, returns defValue (which can be null).

public static float? GetFloat(this IPdfDict dict, PdfName key, float? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue float?

The default value.

Returns

float?

The value associated with the specified key, or defValue.

GetFloat(IPdfDict, PdfName, float)

Gets the Float value associated with the specified key. If the value does not exist or cannot be converted to a Float, returns defValue.

public static float GetFloat(this IPdfDict dict, PdfName key, float defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue float

The default value.

Returns

float

The value associated with the specified key, or defValue.

GetFloatArray(IPdfDict, PdfName, bool)

Gets the float array associated with the specified key. Returns null if the array does not exist or cannot be converted to a float array.

public static float[] GetFloatArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single float value to an array.

Returns

float[]

The array associated with the specified key, or null.

GetInt(IPdfDict, PdfName, int)

Gets the nullable Integer value associated with the specified key. If the value does not exist or cannot be converted to an Integer, returns defValue.

public static int GetInt(this IPdfDict dict, PdfName key, int defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue int

The default value.

Returns

int

The value associated with the specified key, or defValue.

GetInt(IPdfDict, PdfName, int?)

Gets the Integer value associated with the specified key. If the value does not exist or cannot be converted to an Integer, returns defValue (which can be null).

public static int? GetInt(this IPdfDict dict, PdfName key, int? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue int?

The default value.

Returns

int?

The value associated with the specified key, or defValue.

GetIntArray(IPdfDict, PdfName, bool)

Gets the Integer array associated with the specified key. Returns null if the array does not exist or cannot be converted to an Integer array.

public static int[] GetIntArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single Integer value to an array.

Returns

int[]

The array associated with the specified key, or null.

GetMatrix(IPdfDict, PdfName, Matrix3x2?)

Gets the System.Numerics.Matrix3x2 associated with the specified key (in a PDF a System.Numerics.Matrix3x2 should be represented as an array of 6 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Numerics.Matrix3x2.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Numerics.Matrix3x2.
public static Matrix3x2? GetMatrix(this IPdfDict dict, PdfName key, Matrix3x2? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Numerics.Matrix3x2?

The default value.

Returns

System.Numerics.Matrix3x2?

The value associated with the specified key.

GetMatrix(IPdfDict, PdfName, Matrix3x2)

Gets the System.Numerics.Matrix3x2 associated with the specified key (in a PDF a System.Numerics.Matrix3x2 should be represented as an array of 6 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Numerics.Matrix3x2.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Numerics.Matrix3x2.
public static Matrix3x2 GetMatrix(this IPdfDict dict, PdfName key, Matrix3x2 defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Numerics.Matrix3x2

The default value.

Returns

System.Numerics.Matrix3x2

The value associated with the specified key.

GetName(IPdfDict, PdfName, string)

Gets the PDF Name value associated with the specified key. If the value does not exist or cannot be converted to a PDF Name, returns defValue (which can be null).

public static string GetName(this IPdfDict dict, PdfName key, string defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue string

The default value.

Returns

string

The value associated with the specified key, or null.

GetNameArray(IPdfDict, PdfName, bool)

Gets the PdfName array associated with the specified key. Returns null if the array does not exist or cannot be converted to a PdfName array.

public static PdfName[] GetNameArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single PdfName to an array.

Returns

PdfName[]

The array associated with the specified key, or null.

GetNameArrayStr(IPdfDict, PdfName, bool)

Gets the PDF Name array associated with the specified key. Returns null if the array does not exist or cannot be converted to a PDF Name array.

public static string[] GetNameArrayStr(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single PDF Name value to an array.

Returns

string[]

The array associated with the specified key, or null.

GetOffsets(IPdfDict, PdfName, Offsets)

Gets the Offsets associated with the specified key (in a PDF a Offsets should be represented as an array of 4 floats).

Gets defValue if the value does not exist or cannot be converted to an Offsets.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to an Offsets.
public static Offsets GetOffsets(this IPdfDict dict, PdfName key, Offsets defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue Offsets

The default value.

Returns

Offsets

The value associated with the specified key.

GetOffsets(IPdfDict, PdfName, Offsets?)

Gets the Offsets associated with the specified key (in a PDF an Offsets should be represented as an array of 4 floats).

Gets defValue if the value does not exist or cannot be converted to an Offsets.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to an Offsets.
public static Offsets? GetOffsets(this IPdfDict dict, PdfName key, Offsets? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue Offsets?

The default value.

Returns

Offsets?

The value associated with the specified key.

GetPdfDateTime(IPdfDict, PdfName, PdfDateTime?)

Gets the PdfDateTime value associated with the specified key. If the value does not exist or cannot be converted to a PdfDateTime, returns defValue (which can be null).

public static PdfDateTime? GetPdfDateTime(this IPdfDict dict, PdfName key, PdfDateTime? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue PdfDateTime?

The default value.

Returns

PdfDateTime?

The value associated with the specified key, or null.

GetPdfEnum<T>(IPdfDict, PdfName, T)

Gets the PdfEnum<TEnum> value associated with the specified key. If the value does not exist returns defValue.

public static PdfEnum<T> GetPdfEnum<T>(this IPdfDict dict, PdfName key, T defValue) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue T

The default value.

Returns

PdfEnum<T>

The value associated with the specified key, or defValue.

Type Parameters

T

GetPdfEnum<T>(IPdfDict, PdfName, T?)

Gets the nullable PdfEnum<TEnum> value associated with the specified key. If the value does not exist returns defValue (which can be null).

public static PdfEnum<T>? GetPdfEnum<T>(this IPdfDict dict, PdfName key, T? defValue) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue T?

The default value.

Returns

PdfEnum<T>?

The value associated with the specified key, or defValue.

Type Parameters

T

GetPdfStringBytes(IPdfDict, PdfName)

Gets the bytes of the IPdfString associated with the specified key. If the value does not exist or cannot be converted to an IPdfString, returns null.

public static byte[] GetPdfStringBytes(this IPdfDict dict, PdfName key)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

Returns

byte[]

The value associated with the specified key, or null.

GetRect(IPdfDict, PdfName, RectangleF)

Gets the System.Drawing.RectangleF associated with the specified key (in a PDF a System.Drawing.RectangleF should be represented as an array of 4 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Drawing.RectangleF.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Drawing.RectangleF.
public static RectangleF GetRect(this IPdfDict dict, PdfName key, RectangleF defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Drawing.RectangleF

The default value.

Returns

System.Drawing.RectangleF

The value associated with the specified key.

GetRect(IPdfDict, PdfName, RectangleF?)

Gets the System.Drawing.RectangleF associated with the specified key (in a PDF a System.Drawing.RectangleF should be represented as an array of 4 floats).

Gets defValue if the value does not exist or cannot be converted to a System.Drawing.RectangleF.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value cannot be converted to a System.Drawing.RectangleF.
public static RectangleF? GetRect(this IPdfDict dict, PdfName key, RectangleF? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue System.Drawing.RectangleF?

The default value.

Returns

System.Drawing.RectangleF?

The value associated with the specified key.

GetRefArray(IPdfDict, PdfName, bool)

Gets the array of IPdfRef objects associated with the specified key, Returns null if the array does not exist or cannot be converted to an array of IPdfRef.

public static IPdfRef[] GetRefArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the array.

singleToArray bool

Indicates whether to convert a single IPdfRef value to an array.

Returns

IPdfRef[]

The array associated with the specified key, or null.

GetStreamData(IPdfDict)

Returns the decoded stream data if IPdfDict is a PdfStreamObjectBase.

public static byte[] GetStreamData(IPdfDict dict)

Parameters

dict IPdfDict

Returns

byte[]

GetString(IPdfDict, PdfName, string)

Gets the String value associated with the specified key. If the value does not exist or cannot be converted to a String, returns defValue (which can be null).

public static string GetString(this IPdfDict dict, PdfName key, string defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

defValue string

The default value.

Returns

string

The value associated with the specified key, or null.

GetStringArray(IPdfDict, PdfName, bool)

Gets the String array associated with the specified key. Returns null if the array does not exist or cannot be converted to a String array.

public static string[] GetStringArray(this IPdfDict dict, PdfName key, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

singleToArray bool

Indicates whether to convert a single String value to an array.

Returns

string[]

The array associated with the specified key, or null.

GetStringOrName(IPdfDict, PdfName, string)

Gets the string associated with the specified key. The string can be specified in the PDF as a PDF string or a PDF name.

Gets defValue if the value does not exist or cannot be converted to a string.

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to a string.
public static string GetStringOrName(this IPdfDict dict, PdfName key, string defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

defValue string

The default value.

Returns

string

The value associated with the specified key.

Remove(IPdfDict, PdfName)

Removes the value associated with the specified key.

public static bool Remove(this IPdfDict dict, PdfName key)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key to remove.

Returns

bool

true if the element was successfully removed, false otherwise.

RemoveStreamEntries(IPdfDict)

Removes all entries related to the stream: Length, Filter, DecodeParms. The method does not change the Changed flag.

public static void RemoveStreamEntries(this IPdfDict dict)

Parameters

dict IPdfDict

Set(IPdfDict, PdfName, IPdfName, IPdfName)

Sets the PDF Name value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void Set(this IPdfDict dict, PdfName key, IPdfName value, IPdfName defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value IPdfName

The value to set.

defValue IPdfName

The default value.

Set(IPdfDict, PdfName, IPdfObject)

Sets the value associated with the specified key. If value is null, the entry specified by the key will be removed.

public static void Set(this IPdfDict dict, PdfName key, IPdfObject value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to set.

value GrapeCity.Documents.Pdf.Spec.IPdfObject

The value to set.

SetBool(IPdfDict, PdfName, bool?, bool?)

Sets the Boolean value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetBool(this IPdfDict dict, PdfName key, bool? value, bool? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value bool?

The value to set.

defValue bool?

The default value.

SetColor(IPdfDict, PdfName, Color?, Color?)

Sets the Color value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetColor(this IPdfDict dict, PdfName key, Color? value, Color? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value System.Drawing.Color?

The value to set.

defValue System.Drawing.Color?

The default value.

SetDeviceRGBColor(IPdfDict, PdfName, Color?, Color?)

Sets the RGB System.Drawing.Color value associated with the specified key (in a PDF an RGB System.Drawing.Color should be represented as an array of 3 floats).

public static void SetDeviceRGBColor(this IPdfDict dict, PdfName key, Color? value, Color? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to set.

value System.Drawing.Color?

The value to set.

defValue System.Drawing.Color?

The default value.

SetDouble(IPdfDict, PdfName, double?, double?)

Sets the Double value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetDouble(this IPdfDict dict, PdfName key, double? value, double? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value double?

The value to set.

defValue double?

The default value.

SetFloat(IPdfDict, PdfName, float?, float?)

Sets the float value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetFloat(this IPdfDict dict, PdfName key, float? value, float? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value float?

The value to set.

defValue float?

The default value.

SetFloatArray(IPdfDict, PdfName, float[])

Sets the float array associated with the specified key. If the value is null, removes the key from the dictionary.

public static void SetFloatArray(this IPdfDict dict, PdfName key, float[] value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value float[]

The value to set.

SetInt(IPdfDict, PdfName, int?, int?)

Sets the Integer value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetInt(this IPdfDict dict, PdfName key, int? value, int? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value int?

The value to set.

defValue int?

The default value.

SetIntArray(IPdfDict, PdfName, int[])

Sets the int array associated with the specified key. If the value is null, removes the key from the dictionary.

public static void SetIntArray(this IPdfDict dict, PdfName key, int[] value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value int[]

The value to set.

SetMatrix(IPdfDict, PdfName, Matrix3x2?, Matrix3x2?)

Sets the System.Numerics.Matrix3x2 value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetMatrix(this IPdfDict dict, PdfName key, Matrix3x2? value, Matrix3x2? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value System.Numerics.Matrix3x2?

The value to set.

defValue System.Numerics.Matrix3x2?

The default value.

SetName(IPdfDict, PdfName, string, string)

Sets the PDF Name value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary. Note! The method converts a string to the PdfName.

public static void SetName(this IPdfDict dict, PdfName key, string value, string defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

The value to set.

defValue string

The default value.

SetNameArray(IPdfDict, PdfName, string[], bool)

Sets or removes the PDF name array associated with a specified key.

If the specified value is null, the value is removed from the current dictionary. Otherwise the value is set.

public static void SetNameArray(this IPdfDict dict, PdfName key, string[] value, bool singleToArray = true)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string[]

The value to set.

singleToArray bool

If true and value contains exactly one element, the array will be stored as a simple PDF name object.

SetNameNotEmpty(IPdfDict, PdfName, string)

Sets the PDF Name value associated with the specified key. If the value is null or empty, removes the key from the dictionary. Note! The method converts a string to the PdfName.

public static void SetNameNotEmpty(this IPdfDict dict, PdfName key, string value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

The value to set.

SetOffsets(IPdfDict, PdfName, Offsets?, Offsets?)

Sets the Offsets value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetOffsets(this IPdfDict dict, PdfName key, Offsets? value, Offsets? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value Offsets?

The value to set.

defValue Offsets?

The default value.

SetPdfDateTime(IPdfDict, PdfName, PdfDateTime?, PdfDateTime?)

Sets the PdfDateTime value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetPdfDateTime(this IPdfDict dict, PdfName key, PdfDateTime? value, PdfDateTime? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value PdfDateTime?

The value to set.

defValue PdfDateTime?

The default value.

SetPdfEnum<T>(IPdfDict, PdfName, PdfEnum<T>?, T?)

Sets the nullable PdfEnum<TEnum> value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary. Note! The method converts a PdfEnum<TEnum> to the PdfName.

public static void SetPdfEnum<T>(this IPdfDict dict, PdfName key, PdfEnum<T>? value, T? defValue) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value PdfEnum<T>?

The value to set.

defValue T?

The default value.

Type Parameters

T

SetPdfStringBytes(IPdfDict, PdfName, byte[])

Sets the IPdfString associated with the specified key to the specified value. If the value is null, removes the key from the dictionary. Returns the created PdfString.

public static PdfString SetPdfStringBytes(this IPdfDict dict, PdfName key, byte[] value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the string.

value byte[]

The value to set.

Returns

PdfString

The PdfString that was created and set.

SetRect(IPdfDict, PdfName, RectangleF?, RectangleF?)

Sets the System.Drawing.RectangleF value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary.

public static void SetRect(this IPdfDict dict, PdfName key, RectangleF? value, RectangleF? defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value System.Drawing.RectangleF?

The value to set.

defValue System.Drawing.RectangleF?

The default value.

SetRichTextNotEmpty(IPdfDict, PdfName, string)

Sets the String value representing the Rich Text associated with the specified key. If the value is null or empty removes the key from the dictionary. Note! The method converts a string to the PdfString. Note! The method encloses the value with PdfConsts.c_RichStringPrefix and PdfConsts.c_RichStringSuffix

public static void SetRichTextNotEmpty(this IPdfDict dict, PdfName key, string value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

The value to set.

SetSilent(IPdfDict, PdfName, IPdfObject)

Sets the value associated with the specified key without affecting the Changed value. If value is null, the entry specified by the key will be removed.

public static void SetSilent(this IPdfDict dict, PdfName key, IPdfObject value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to set.

value GrapeCity.Documents.Pdf.Spec.IPdfObject

The value to set.

SetString(IPdfDict, PdfName, string, string)

Sets the String value associated with the specified key. If the value is null or is equal to defValue, removes the key from the dictionary. Note! The method converts a string to the PdfString.

public static void SetString(this IPdfDict dict, PdfName key, string value, string defValue)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

The value to set.

defValue string

The default value.

SetStringArray(IPdfDict, PdfName, IEnumerable<string>, bool)

Sets or removes the PDF string array associated with a specified key.

If the specified value is null, the value is removed from the current dictionary. Otherwise the value is set.

public static void SetStringArray(this IPdfDict dict, PdfName key, IEnumerable<string> value, bool singleToArray = true)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value System.Collections.Generic.IEnumerable<T><string>

The value to set.

singleToArray bool

If true and value contains exactly one element, the array will be stored as a simple PDF string object.

SetStringNotEmpty(IPdfDict, PdfName, string)

Sets the String value associated with the specified key. If the value is null or empty removes the key from the dictionary. Note! The method converts a string to the PdfString.

public static void SetStringNotEmpty(this IPdfDict dict, PdfName key, string value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

The value to set.

TryGet<T>(IPdfDict, PdfName, out T, bool)

Tries to get the value associated with the specified key, if the value does not exist or cannot be converted to a T returns false.

public static bool TryGet<T>(this IPdfDict dict, PdfName key, out T value, bool addWarning = true) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value T

OUT: The value.

addWarning bool

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if value at the specified index can't be converted to the T.

Returns

bool

true if value exists, false otherwise.

Type Parameters

T

TryGet<T>(IPdfDict, PdfName, out T, out bool, bool)

Tries to get the value associated with the specified key, Returns true if value exists and can be converted to a T, resolves a PDF reference if needed. Note! The method does not resolve reference if T is IPdfRef, otherwise the method resolves the reference and returns actual object.

public static bool TryGet<T>(this IPdfDict dict, PdfName key, out T value, out bool isNull, bool addWarning) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value T

OUT: The value.

isNull bool

OUT: Indicates whether the value is PDF null.

addWarning bool

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if errors occur.

Returns

bool

Returns true if no errors occur.

Type Parameters

T

TryGetArray<T>(IPdfDict, PdfName, out T[], bool, bool, bool)

Tries to gets the array of T objects associated with the specified key.

public static bool TryGetArray<T>(IPdfDict dict, PdfName key, out T[] value, bool singleToArray, bool allowNulls, bool addWarning) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the array.

value T[]

OUT: The array of T.

singleToArray bool

Indicates whether to convert a single T value to an array.

allowNulls bool

Indicates whether to handle IPdfNull as null.

addWarning bool

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if errors occur.

Returns

bool

Returns true if no errors occur.

Type Parameters

T

TryGetArray<T>(IPdfDict, PdfName, out T[], bool)

Tries to get the array associated with the specified key, if the value does not exist or cannot be converted to an array of T returns false.

public static bool TryGetArray<T>(this IPdfDict dict, PdfName key, out T[] value, bool singleToArray = false) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value T[]

OUT: The value.

singleToArray bool

Indicates whether to convert a single T value to an array.

Returns

bool

true if value exists, false otherwise.

Type Parameters

T

TryGetAtPath<T>(IPdfDict, out T, out bool, bool, params object[])

Gets the value at the specified path. The path can contain IPdfName objects which are interpreted as dictionary keys, or integers which are interpreted as IPdfArray indices.

public static bool TryGetAtPath<T>(IPdfDict dict, out T value, out bool isNull, bool addWarning, params object[] path) where T : IPdfObject

Parameters

dict IPdfDict

The current dictionary.

value T

OUT: The value.

isNull bool

OUT: Indicates whether the value is PDF null.

addWarning bool

Indicates whether to add a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if errors occur.

path object[]

The path to the value.

Returns

bool

The value associated with the specified path, or null if the value could not be found.

Type Parameters

T

TryGetBool(IPdfDict, PdfName, out bool)

Tries to get the Boolean value associated with the specified key. If the value does not exist or cannot be converted to a Boolean, returns false.

public static bool TryGetBool(this IPdfDict dict, PdfName key, out bool value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value bool

OUT. When this method returns, contains the Boolean value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if value exists; otherwise, false.

TryGetBoolArray(IPdfDict, PdfName, out bool[], bool)

Tries to get the bool array associated with the specified key.

public static bool TryGetBoolArray(this IPdfDict dict, PdfName key, out bool[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value bool[]

OUT: The array of bool.

singleToArray bool

Indicates whether to convert a single bool value to an array.

Returns

bool

true if successful; false otherwise.

TryGetColor(IPdfDict, PdfName, out Color)

Tries to get the System.Drawing.Color associated with the specified key (in a PDF a System.Drawing.Color should be represented as an array of 1, 3 or 4 floats).

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to System.Drawing.Color.

public static bool TryGetColor(this IPdfDict dict, PdfName key, out Color value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value System.Drawing.Color

OUT: the value associated with the specified key.

Returns

bool

True if the key was found and the value could be converted to a System.Drawing.Color, false otherwise.

TryGetDeviceRGBColor(IPdfDict, PdfName, out Color)

Tries to get the RGB System.Drawing.Color associated with the specified key (in a PDF an RGB System.Drawing.Color should be represented as an array of 3 floats).

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to System.Drawing.Color.

public static bool TryGetDeviceRGBColor(this IPdfDict dict, PdfName key, out Color value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value System.Drawing.Color

OUT: the value associated with the specified key.

Returns

bool

True if the key was found and the value could be converted to a System.Drawing.Color, false otherwise.

TryGetDictArray(IPdfDict, PdfName, out IPdfDict[], bool)

Tries to gets the array of IPdfDict objects associated with the specified key.

public static bool TryGetDictArray(this IPdfDict dict, PdfName key, out IPdfDict[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the array.

value IPdfDict[]

OUT: The array of IPdfDict.

singleToArray bool

Indicates whether to convert a single IPdfDict value to an array.

Returns

bool

true if successful, false otherwise.

TryGetDouble(IPdfDict, PdfName, out double)

Tries to get the Double value associated with the specified key. If the value does not exist or cannot be converted to a Double, returns false.

public static bool TryGetDouble(this IPdfDict dict, PdfName key, out double value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value double

OUT. When this method returns, contains the Double value.

Returns

bool

true if value exists; otherwise, false.

TryGetEnum<T>(IPdfDict, PdfName, out T)

Tries to get the enum value associated with the specified key. If the value does not exist or cannot be converted to an enum, returns false.

public static bool TryGetEnum<T>(this IPdfDict dict, PdfName key, out T value) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value T

OUT. When this method returns, contains the enum value.

Returns

bool

true if value exists; otherwise, false.

Type Parameters

T

TryGetFloat(IPdfDict, PdfName, out float)

Tries to get the Float value associated with the specified key. If the value does not exist or cannot be converted to a Float, returns false.

public static bool TryGetFloat(this IPdfDict dict, PdfName key, out float value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value float

OUT. When this method returns, contains the Float value.

Returns

bool

true if value exists; otherwise, false.

TryGetFloatArray(IPdfDict, PdfName, out float[], bool)

Tries to get the float array associated with the specified key.

public static bool TryGetFloatArray(this IPdfDict dict, PdfName key, out float[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value float[]

OUT: The array of float.

singleToArray bool

Indicates whether to convert a single float value to an array.

Returns

bool

true if successful; false otherwise.

TryGetInt(IPdfDict, PdfName, out int)

Tries to get the Integer value associated with the specified key. If the value does not exist or cannot be converted to an Integer, returns false.

public static bool TryGetInt(this IPdfDict dict, PdfName key, out int value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value int

OUT. When this method returns, contains the Integer value.

Returns

bool

true if value exists; otherwise, false.

TryGetIntArray(IPdfDict, PdfName, out int[], bool)

Tries to get the Integer array associated with the specified key.

public static bool TryGetIntArray(this IPdfDict dict, PdfName key, out int[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value int[]

OUT: The array of int.

singleToArray bool

Indicates whether to convert a single Integer value to an array.

Returns

bool

true if successful; false otherwise.

TryGetMatrix(IPdfDict, PdfName, out Matrix3x2)

Tries to get the System.Numerics.Matrix3x2 associated with the specified key (in a PDF a System.Numerics.Matrix3x2 should be represented as an array of 6 floats).

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to System.Numerics.Matrix3x2.

public static bool TryGetMatrix(this IPdfDict dict, PdfName key, out Matrix3x2 value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value System.Numerics.Matrix3x2

OUT: the value associated with the specified key.

Returns

bool

True if the key was found and the value could be converted to a System.Numerics.Matrix3x2, false otherwise.

TryGetName(IPdfDict, PdfName, out string)

Tries to get the PDF Name value associated with the specified key. If the value does not exist or cannot be converted to a PDF Name, returns false.

public static bool TryGetName(this IPdfDict dict, PdfName key, out string value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

OUT. When this method returns, contains the PDF Name value.

Returns

bool

true if value exists; otherwise, false.

TryGetNameArray(IPdfDict, PdfName, out PdfName[], bool)

Tries to get the PDF Name array associated with the specified key.

public static bool TryGetNameArray(this IPdfDict dict, PdfName key, out PdfName[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value PdfName[]

OUT: The array of PdfName.

singleToArray bool

Indicates whether to convert a single PDF Name value to an array.

Returns

bool

The array associated with the specified key, or null.

TryGetNameArrayStr(IPdfDict, PdfName, out string[], bool)

Tries to get the PDF Name array associated with the specified key, the PDF names converted to strings.

public static bool TryGetNameArrayStr(this IPdfDict dict, PdfName key, out string[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string[]

OUT: The array of strings.

singleToArray bool

Indicates whether to convert a single PDF Name value to an array.

Returns

bool

The array associated with the specified key, or null.

TryGetOffsets(IPdfDict, PdfName, out Offsets)

Tries to get the Offsets associated with the specified key (in a PDF an Offsets should be represented as an array of 4 floats).

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to Offsets.

public static bool TryGetOffsets(this IPdfDict dict, PdfName key, out Offsets value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value Offsets

OUT: the value associated with the specified key.

Returns

bool

True if the key was found and the value could be converted to an Offsets, false otherwise.

TryGetPdfDateTime(IPdfDict, PdfName, out PdfDateTime?)

Tries to get the PdfDateTime value associated with the specified key. If the value does not exist or cannot be converted to the PdfDateTime, returns false.

public static bool TryGetPdfDateTime(this IPdfDict dict, PdfName key, out PdfDateTime? value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value PdfDateTime?

OUT. When this method returns, contains the PdfDateTime value.

Returns

bool

true if value exists; otherwise, false.

TryGetPdfEnum<T>(IPdfDict, PdfName, out PdfEnum<T>)

Tries to get the PdfEnum<TEnum> value associated with the specified key. If the value does not exist or cannot be converted to an enum, returns false.

public static bool TryGetPdfEnum<T>(this IPdfDict dict, PdfName key, out PdfEnum<T> value) where T : struct

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value PdfEnum<T>

OUT. When this method returns, contains the enum value.

Returns

bool

true if value exists; otherwise, false.

Type Parameters

T

TryGetRect(IPdfDict, PdfName, out RectangleF)

Tries to get the System.Drawing.RectangleF associated with the specified key (in a PDF a System.Drawing.RectangleF should be represented as an array of 4 floats).

Adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to System.Drawing.RectangleF.

public static bool TryGetRect(this IPdfDict dict, PdfName key, out RectangleF value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value System.Drawing.RectangleF

OUT: the value associated with the specified key.

Returns

bool

True if the key was found and the value could be converted to a System.Drawing.RectangleF, false otherwise.

TryGetRefArray(IPdfDict, PdfName, out IPdfRef[], bool)

Tries to gets the array of IPdfRef objects associated with the specified key.

public static bool TryGetRefArray(this IPdfDict dict, PdfName key, out IPdfRef[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the array.

value IPdfRef[]

OUT: The array of IPdfRef.

singleToArray bool

Indicates whether to convert a single IPdfRef value to an array.

Returns

bool

true if successful, false otherwise.

TryGetString(IPdfDict, PdfName, out string)

Tries to get the String value associated with the specified key. If the value does not exist or cannot be converted to a String, returns false.

public static bool TryGetString(this IPdfDict dict, PdfName key, out string value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string

OUT. When this method returns, contains the String value.

Returns

bool

true if value exists; otherwise, false.

TryGetStringArray(IPdfDict, PdfName, out string[], bool)

Tries to get the string array associated with the specified key.

public static bool TryGetStringArray(this IPdfDict dict, PdfName key, out string[] value, bool singleToArray = false)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key identifying the value.

value string[]

OUT: The array of string.

singleToArray bool

Indicates whether to convert a single string value to an array.

Returns

bool

true if successful; false otherwise.

TryGetStringOrName(IPdfDict, PdfName, out string, bool)

Tries to get the string associated with the specified key. The string can be specified in the PDF as a PDF string or a PDF name.

Optionally adds a warning to GrapeCity.Documents.Pdf.GcPdfDocument.ParserLog if the value exists but cannot be converted to a PdfString.

public static bool TryGetStringOrName(this IPdfDict dict, PdfName key, out string value, bool addWarning = true)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value to get.

value string

OUT: the value associated with the specified key.

addWarning bool

Specifies whether to add a warning if the value could not be converted.

Returns

bool

True if the key was found and the value could be converted to a Boolean, false otherwise.

TryGetValue(IPdfDict, PdfName, out IPdfObject)

Tries to get a value with specified key. The method does not perform any processing of the value and returns it as is.

public static bool TryGetValue(this IPdfDict dict, PdfName key, out IPdfObject value)

Parameters

dict IPdfDict

The current dictionary.

key PdfName

The key of the value.

value GrapeCity.Documents.Pdf.Spec.IPdfObject

OUT: The value.

Returns

bool

true if value exists, false otherwise.