[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.Spec.IPdfDictExt.TryGet

TryGet Method

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.

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

The current dictionary.

PdfName key

The key identifying the value.

T value

OUT: The value.

bool isNull

OUT: Indicates whether the value is PDF null.

bool addWarning

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

Returns
Type Description
bool

Returns true if no errors occur.

Type Parameters
Name Description
T

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.

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

The current dictionary.

PdfName key

The key identifying the value.

T value

OUT: The value.

bool addWarning

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
Type Description
bool

true if value exists, false otherwise.

Type Parameters
Name Description
T