Table of Contents

Class PdfResources

Namespace
iText.Kernel.Pdf
Assembly
itext.kernel.dll

Wrapper class that represent resource dictionary - that define named resources used by content streams operators.

public class PdfResources : PdfObjectWrapper<PdfDictionary>
Inheritance
PdfResources
Inherited Members

Remarks

Wrapper class that represent resource dictionary - that define named resources used by content streams operators. (ISO 32000-1, 7.8.3 Resource Dictionaries)

Constructors

PdfResources()

Creates new instance from empty dictionary.

public PdfResources()

PdfResources(PdfDictionary)

Creates new instance from given dictionary.

public PdfResources(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

the PdfDictionary object from which the resource object will be created.

Methods

AddColorSpace(PdfColorSpace)

Adds PdfColorSpace object to the resources.

public virtual PdfName AddColorSpace(PdfColorSpace cs)

Parameters

cs PdfColorSpace

the PdfColorSpace to add.

Returns

PdfName

added color space resource name.

AddColorSpace(PdfObject)

Adds PdfObject to the resources as color space.

public virtual PdfName AddColorSpace(PdfObject colorSpace)

Parameters

colorSpace PdfObject

the PdfObject to add.

Returns

PdfName

added color space resources name.

AddExtGState(PdfExtGState)

Adds PdfExtGState object to the resources.

public virtual PdfName AddExtGState(PdfExtGState extGState)

Parameters

extGState PdfExtGState

the PdfExtGState to add.

Returns

PdfName

added graphics state parameter dictionary resource name.

AddExtGState(PdfDictionary)

Adds PdfDictionary to the resources as graphics state parameter dictionary.

public virtual PdfName AddExtGState(PdfDictionary extGState)

Parameters

extGState PdfDictionary

the PdfDictionary to add.

Returns

PdfName

added graphics state parameter dictionary resources name.

AddFont(PdfDocument, PdfFont)

Adds font to resources and registers PdfFont in the document for further flushing.

public virtual PdfName AddFont(PdfDocument pdfDocument, PdfFont font)

Parameters

pdfDocument PdfDocument

a PdfDocument instance to which the font is added for further flushing

font PdfFont

a PdfFont instance to be added

Returns

PdfName

added font resource name.

AddForm(PdfStream)

Adds PdfStream to the resources as form.

public virtual PdfName AddForm(PdfStream form)

Parameters

form PdfStream

the PdfStream to add.

Returns

PdfName

added form resources name.

AddForm(PdfFormXObject)

Adds PdfFormXObject object to the resources.

public virtual PdfName AddForm(PdfFormXObject form)

Parameters

form PdfFormXObject

the PdfFormXObject to add.

Returns

PdfName

added form resource name.

AddForm(PdfFormXObject, PdfName)

Adds the given Form XObject to the current instance of PdfResources.

public virtual PdfName AddForm(PdfFormXObject form, PdfName name)

Parameters

form PdfFormXObject

Form XObject.

name PdfName

Preferred name for the given Form XObject.

Returns

PdfName

the PdfName of the newly added resource

AddImage(PdfStream)

Adds PdfStream to the resources as image.

public virtual PdfName AddImage(PdfStream image)

Parameters

image PdfStream

the PdfStream to add.

Returns

PdfName

added image resources name.

AddImage(PdfImageXObject)

Adds PdfImageXObject object to the resources.

public virtual PdfName AddImage(PdfImageXObject image)

Parameters

image PdfImageXObject

the PdfImageXObject to add.

Returns

PdfName

added image resource name.

AddPattern(PdfPattern)

Adds PdfPattern object to the resources.

public virtual PdfName AddPattern(PdfPattern pattern)

Parameters

pattern PdfPattern

the PdfPattern to add.

Returns

PdfName

added pattern resource name.

AddPattern(PdfDictionary)

Adds PdfDictionary to the resources as pattern.

public virtual PdfName AddPattern(PdfDictionary pattern)

Parameters

pattern PdfDictionary

the PdfDictionary to add.

Returns

PdfName

added pattern resources name.

AddProperties(PdfDictionary)

Adds PdfDictionary to the resources as properties list.

public virtual PdfName AddProperties(PdfDictionary properties)

Parameters

properties PdfDictionary

the PdfDictionary to add.

Returns

PdfName

added properties list resources name.

AddResource(PdfObject, PdfName, PdfName)

protected virtual void AddResource(PdfObject resource, PdfName resType, PdfName resName)

Parameters

resource PdfObject
resType PdfName
resName PdfName

AddShading(PdfShading)

Adds PdfShading object to the resources.

public virtual PdfName AddShading(PdfShading shading)

Parameters

shading PdfShading

the PdfShading to add.

Returns

PdfName

added shading resource name.

AddShading(PdfDictionary)

Adds PdfDictionary to the resources as shading dictionary.

public virtual PdfName AddShading(PdfDictionary shading)

Parameters

shading PdfDictionary

the PdfDictionary to add.

Returns

PdfName

added shading dictionary resources name.

BuildResources(PdfDictionary)

protected virtual void BuildResources(PdfDictionary dictionary)

Parameters

dictionary PdfDictionary

GetColorSpace(PdfName)

public virtual PdfColorSpace GetColorSpace(PdfName name)

Parameters

name PdfName

Returns

PdfColorSpace

GetForm(PdfName)

public virtual PdfFormXObject GetForm(PdfName name)

Parameters

name PdfName

Returns

PdfFormXObject

GetImage(PdfName)

public virtual PdfImageXObject GetImage(PdfName name)

Parameters

name PdfName

Returns

PdfImageXObject

GetPattern(PdfName)

public virtual PdfPattern GetPattern(PdfName name)

Parameters

name PdfName

Returns

PdfPattern

GetPdfExtGState(PdfName)

public virtual PdfExtGState GetPdfExtGState(PdfName name)

Parameters

name PdfName

Returns

PdfExtGState

GetProcSet()

Gets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2).

public virtual PdfArray GetProcSet()

Returns

PdfArray

the array of predefined procedure set names.

Remarks

Gets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2). Deprecated in PDF 2.0.

GetProperties(PdfName)

public virtual PdfObject GetProperties(PdfName name)

Parameters

name PdfName

Returns

PdfObject

GetResource(PdfName)

Get the PdfDictionary object that that contain resources of specified type.

public virtual PdfDictionary GetResource(PdfName resType)

Parameters

resType PdfName

the resource type. Should be ColorSpace , ExtGState , Pattern , Shading , XObject , Font.

Returns

PdfDictionary

the PdfDictionary object containing all resources of specified type, or null in case of incorrect resource type.

GetResourceName(PdfObject)

Gets the mapped resource name of the given PdfObject.

public virtual PdfName GetResourceName(PdfObject resource)

Parameters

resource PdfObject

the object, for which the name will be searched.

Returns

PdfName

the mapped resource name or null if object isn't added to resources.

Remarks

Gets the mapped resource name of the given PdfObject.

Note: if the name for the object won't be found, then the name of object's Indirect Reference will be searched.

GetResourceName<T>(PdfObjectWrapper<T>)

Gets the mapped resource name of the PdfObject under the given wrapper.

public virtual PdfName GetResourceName<T>(PdfObjectWrapper<T> resource) where T : PdfObject

Parameters

resource PdfObjectWrapper<T>

the wrapper of the PdfObject , for which the name will be searched.

Returns

PdfName

the mapped resource name or null if object isn't added to resources.

Type Parameters

T

the type of the underlined PdfObject in wrapper.

Remarks

Gets the mapped resource name of the PdfObject under the given wrapper.

Note: if the name for the object won't be found, then the name of object's Indirect Reference will be searched.

GetResourceNames()

Gets the names of all the added resources.

public virtual ICollection<PdfName> GetResourceNames()

Returns

ICollection<PdfName>

the name of all the added resources.

GetResourceNames(PdfName)

Gets the names of all resources of specified type.

public virtual ICollection<PdfName> GetResourceNames(PdfName resType)

Parameters

resType PdfName

the resource type. Should be ColorSpace , ExtGState , Pattern , Shading , XObject , Font.

Returns

ICollection<PdfName>

set of resources name of corresponding type. May be empty. Will be empty in case of incorrect resource type.

GetResourceObject(PdfName, PdfName)

Get the PdfObject object with specified type and name.

public virtual PdfObject GetResourceObject(PdfName resType, PdfName resName)

Parameters

resType PdfName

the resource type. Should be ColorSpace , ExtGState , Pattern , Shading , XObject , Font.

resName PdfName

the name of the resource object.

Returns

PdfObject

the PdfObject with specified name in the resources of specified type or null in case of incorrect type or missing resource with such name.

GetShading(PdfName)

public virtual PdfShading GetShading(PdfName name)

Parameters

name PdfName

Returns

PdfShading

IsModified()

protected virtual bool IsModified()

Returns

bool

IsReadOnly()

protected virtual bool IsReadOnly()

Returns

bool

IsWrappedObjectMustBeIndirect()

protected override bool IsWrappedObjectMustBeIndirect()

Returns

bool

SetDefaultCmyk(PdfColorSpace)

Sets the value of default CMYK Color Space (see ISO-320001 Paragraph 8.6.5.6).

public virtual void SetDefaultCmyk(PdfColorSpace defaultCs)

Parameters

defaultCs PdfColorSpace

the color space to set.

SetDefaultGray(PdfColorSpace)

Sets the value of default Gray Color Space (see ISO-320001 Paragraph 8.6.5.6).

public virtual void SetDefaultGray(PdfColorSpace defaultCs)

Parameters

defaultCs PdfColorSpace

the color space to set.

SetDefaultRgb(PdfColorSpace)

Sets the value of default RGB Color Space (see ISO-320001 Paragraph 8.6.5.6).

public virtual void SetDefaultRgb(PdfColorSpace defaultCs)

Parameters

defaultCs PdfColorSpace

the color space to set.

SetModified()

public override PdfObjectWrapper<PdfDictionary> SetModified()

Returns

PdfObjectWrapper<PdfDictionary>

SetProcSet(PdfArray)

Sets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2).

public virtual void SetProcSet(PdfArray array)

Parameters

array PdfArray

the array of predefined procedure set names to be set.

Remarks

Sets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2). Deprecated in PDF 2.0.

SetReadOnly(bool)

protected virtual void SetReadOnly(bool readOnly)

Parameters

readOnly bool