iText 9.0.0 API
iText.Kernel.Pdf.PdfResources Class Reference

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

Inheritance diagram for iText.Kernel.Pdf.PdfResources:
iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >

Public Member Functions

  PdfResources (PdfDictionary pdfObject)
  Creates new instance from given dictionary. More...
 
  PdfResources ()
  Creates new instance from empty dictionary. More...
 
virtual PdfName  AddFont (PdfDocument pdfDocument, PdfFont font)
  Adds font to resources and registers PdfFont in the document for further flushing. More...
 
virtual PdfName  AddImage (PdfImageXObject image)
  Adds iText.Kernel.Pdf.Xobject.PdfImageXObject object to the resources. More...
 
virtual PdfName  AddImage (PdfStream image)
  Adds PdfStream to the resources as image. More...
 
virtual PdfImageXObject  GetImage (PdfName name)
 
virtual PdfName  AddForm (PdfFormXObject form)
  Adds iText.Kernel.Pdf.Xobject.PdfFormXObject object to the resources. More...
 
virtual PdfName  AddForm (PdfStream form)
  Adds PdfStream to the resources as form. More...
 
virtual PdfName  AddForm (PdfFormXObject form, PdfName name)
  Adds the given Form XObject to the current instance of PdfResources. More...
 
virtual PdfFormXObject  GetForm (PdfName name)
 
virtual PdfName  AddExtGState (PdfExtGState extGState)
  Adds iText.Kernel.Pdf.Extgstate.PdfExtGState object to the resources. More...
 
virtual PdfName  AddExtGState (PdfDictionary extGState)
  Adds PdfDictionary to the resources as graphics state parameter dictionary. More...
 
virtual PdfExtGState  GetPdfExtGState (PdfName name)
 
virtual PdfName  AddProperties (PdfDictionary properties)
  Adds PdfDictionary to the resources as properties list. More...
 
virtual PdfObject  GetProperties (PdfName name)
 
virtual PdfName  AddColorSpace (PdfColorSpace cs)
  Adds iText.Kernel.Pdf.Colorspace.PdfColorSpace object to the resources. More...
 
virtual PdfName  AddColorSpace (PdfObject colorSpace)
  Adds PdfObject to the resources as color space. More...
 
virtual PdfColorSpace  GetColorSpace (PdfName name)
 
virtual PdfName  AddPattern (PdfPattern pattern)
  Adds iText.Kernel.Pdf.Colorspace.PdfPattern object to the resources. More...
 
virtual PdfName  AddPattern (PdfDictionary pattern)
  Adds PdfDictionary to the resources as pattern. More...
 
virtual PdfPattern  GetPattern (PdfName name)
 
virtual PdfName  AddShading (AbstractPdfShading shading)
  Adds iText.Kernel.Pdf.Colorspace.Shading.AbstractPdfShading object to the resources. More...
 
virtual PdfName  AddShading (PdfDictionary shading)
  Adds PdfDictionary to the resources as shading dictionary. More...
 
virtual AbstractPdfShading  GetShading (PdfName name)
 
override PdfObjectWrapper< PdfDictionary SetModified ()
 
virtual void  SetDefaultGray (PdfColorSpace defaultCs)
  Sets the value of default Gray Color Space (see ISO-320001 Paragraph 8.6.5.6). More...
 
virtual void  SetDefaultRgb (PdfColorSpace defaultCs)
  Sets the value of default RGB Color Space (see ISO-320001 Paragraph 8.6.5.6). More...
 
virtual void  SetDefaultCmyk (PdfColorSpace defaultCs)
  Sets the value of default CMYK Color Space (see ISO-320001 Paragraph 8.6.5.6). More...
 
virtual PdfName  GetResourceName< T > (PdfObjectWrapper< T > resource)
  Gets the mapped resource name of the PdfObject under the given wrapper. More...
 
virtual PdfName  GetResourceName (PdfObject resource)
  Gets the mapped resource name of the given PdfObject. More...
 
virtual ICollection< PdfName GetResourceNames ()
  Gets the names of all the added resources. More...
 
virtual PdfArray  GetProcSet ()
  Gets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2). More...
 
virtual void  SetProcSet (PdfArray array)
  Sets the array of predefined procedure set names (see ISO-320001 Paragraph 14.2). More...
 
virtual ICollection< PdfName GetResourceNames (PdfName resType)
  Gets the names of all resources of specified type. More...
 
virtual PdfDictionary  GetResource (PdfName resType)
  Get the PdfDictionary object that that contain resources of specified type. More...
 
virtual PdfObject  GetResourceObject (PdfName resType, PdfName resName)
  Get the PdfObject object with specified type and name. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
virtual T  GetPdfObject ()
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document, PdfIndirectReference reference)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual iText.Kernel.Pdf.PdfObjectWrapper< T >  MakeIndirect (PdfDocument document)
  Marks object behind wrapper to be saved as indirect. More...
 
virtual void  Flush ()
 
virtual bool  IsFlushed ()
 

Package Functions

virtual bool  IsReadOnly ()
 
virtual void  SetReadOnly (bool readOnly)
 
virtual bool  IsModified ()
 
override bool  IsWrappedObjectMustBeIndirect ()
  Defines if the object behind this wrapper must be an indirect object in the resultant document. More...
 
virtual void  AddResource (PdfObject resource, PdfName resType, PdfName resName)
 
virtual void  BuildResources (PdfDictionary dictionary)
 
- Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
  PdfObjectWrapper (T pdfObject)
 
virtual void  SetPdfObject (T pdfObject)
 
virtual void  SetForbidRelease ()
 
virtual void  UnsetForbidRelease ()
 
virtual void  EnsureUnderlyingObjectHasIndirectReference ()
 

Additional Inherited Members

- Static Package Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >
static void  MarkObjectAsIndirect (PdfObject pdfObject)
 
static void  EnsureObjectIsAddedToDocument (PdfObject @object)
  Some wrappers use object's indirect reference to obtain the PdfDocument to which the object belongs to. More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ PdfResources() [1/2]

iText.Kernel.Pdf.PdfResources.PdfResources ( PdfDictionary  pdfObject )
inline

Creates new instance from given dictionary.

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

◆ PdfResources() [2/2]

iText.Kernel.Pdf.PdfResources.PdfResources ( )
inline

Creates new instance from empty dictionary.

Member Function Documentation

◆ AddColorSpace() [1/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddColorSpace ( PdfColorSpace  cs )
inlinevirtual

Adds iText.Kernel.Pdf.Colorspace.PdfColorSpace object to the resources.

Parameters
cs the iText.Kernel.Pdf.Colorspace.PdfColorSpace to add.
Returns
added color space resource name.

◆ AddColorSpace() [2/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddColorSpace ( PdfObject  colorSpace )
inlinevirtual

Adds PdfObject to the resources as color space.

Parameters
colorSpace the PdfObject to add.
Returns
added color space resources name.

◆ AddExtGState() [1/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddExtGState ( PdfDictionary  extGState )
inlinevirtual

Adds PdfDictionary to the resources as graphics state parameter dictionary.

Parameters
extGState the PdfDictionary to add.
Returns
added graphics state parameter dictionary resources name.

◆ AddExtGState() [2/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddExtGState ( PdfExtGState  extGState )
inlinevirtual

Adds iText.Kernel.Pdf.Extgstate.PdfExtGState object to the resources.

Parameters
extGState the iText.Kernel.Pdf.Extgstate.PdfExtGState to add.
Returns
added graphics state parameter dictionary resource name.

◆ AddFont()

virtual PdfName iText.Kernel.Pdf.PdfResources.AddFont ( PdfDocument  pdfDocument,
PdfFont  font 
)
inlinevirtual

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

Parameters
pdfDocument a PdfDocument instance to which the font is added for further flushing
font a iText.Kernel.Font.PdfFont instance to be added
Returns
added font resource name.

◆ AddForm() [1/3]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddForm ( PdfFormXObject  form )
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfFormXObject object to the resources.

Parameters
form the iText.Kernel.Pdf.Xobject.PdfFormXObject to add.
Returns
added form resource name.

◆ AddForm() [2/3]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddForm ( PdfFormXObject  form,
PdfName  name 
)
inlinevirtual

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

Parameters
form Form XObject.
name Preferred name for the given Form XObject.
Returns
the PdfName of the newly added resource

◆ AddForm() [3/3]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddForm ( PdfStream  form )
inlinevirtual

Adds PdfStream to the resources as form.

Parameters
form the PdfStream to add.
Returns
added form resources name.

◆ AddImage() [1/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddImage ( PdfImageXObject  image )
inlinevirtual

Adds iText.Kernel.Pdf.Xobject.PdfImageXObject object to the resources.

Parameters
image the iText.Kernel.Pdf.Xobject.PdfImageXObject to add.
Returns
added image resource name.

◆ AddImage() [2/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddImage ( PdfStream  image )
inlinevirtual

Adds PdfStream to the resources as image.

Parameters
image the PdfStream to add.
Returns
added image resources name.

◆ AddPattern() [1/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddPattern ( PdfDictionary  pattern )
inlinevirtual

Adds PdfDictionary to the resources as pattern.

Parameters
pattern the PdfDictionary to add.
Returns
added pattern resources name.

◆ AddPattern() [2/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddPattern ( PdfPattern  pattern )
inlinevirtual

Adds iText.Kernel.Pdf.Colorspace.PdfPattern object to the resources.

Parameters
pattern the iText.Kernel.Pdf.Colorspace.PdfPattern to add.
Returns
added pattern resource name.

◆ AddProperties()

virtual PdfName iText.Kernel.Pdf.PdfResources.AddProperties ( PdfDictionary  properties )
inlinevirtual

Adds PdfDictionary to the resources as properties list.

Parameters
properties the PdfDictionary to add.
Returns
added properties list resources name.

◆ AddShading() [1/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddShading ( AbstractPdfShading  shading )
inlinevirtual

Adds iText.Kernel.Pdf.Colorspace.Shading.AbstractPdfShading object to the resources.

Parameters
shading the iText.Kernel.Pdf.Colorspace.Shading.AbstractPdfShading to add.
Returns
added shading resource name.

◆ AddShading() [2/2]

virtual PdfName iText.Kernel.Pdf.PdfResources.AddShading ( PdfDictionary  shading )
inlinevirtual

Adds PdfDictionary to the resources as shading dictionary.

Parameters
shading the PdfDictionary to add.
Returns
added shading dictionary resources name.

◆ GetProcSet()

virtual PdfArray iText.Kernel.Pdf.PdfResources.GetProcSet ( )
inlinevirtual

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

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

Returns
the array of predefined procedure set names.

◆ GetResource()

virtual PdfDictionary iText.Kernel.Pdf.PdfResources.GetResource ( PdfName  resType )
inlinevirtual

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

Parameters
resType the resource type. Should be PdfName.ColorSpace , PdfName.ExtGState , PdfName.Pattern , PdfName.Shading , PdfName.XObject , PdfName.Font.
Returns
the PdfDictionary object containing all resources of specified type, or null in case of incorrect resource type.

◆ GetResourceName()

virtual PdfName iText.Kernel.Pdf.PdfResources.GetResourceName ( PdfObject  resource )
inlinevirtual

Gets the mapped resource name of the given PdfObject.

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.

Parameters
resource the object, for which the name will be searched.
Returns
the mapped resource name or null if object isn't added to resources.

◆ GetResourceName< T >()

virtual PdfName iText.Kernel.Pdf.PdfResources.GetResourceName< T > ( PdfObjectWrapper< T >  resource )
inlinevirtual

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

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.

Parameters
resource the wrapper of the PdfObject , for which the name will be searched.
Template Parameters
T the type of the underlined PdfObject in wrapper.
Returns
the mapped resource name or null if object isn't added to resources.
Type Constraints
T  : PdfObject  

◆ GetResourceNames() [1/2]

virtual ICollection<PdfName> iText.Kernel.Pdf.PdfResources.GetResourceNames ( )
inlinevirtual

Gets the names of all the added resources.

Returns
the name of all the added resources.

◆ GetResourceNames() [2/2]

virtual ICollection<PdfName> iText.Kernel.Pdf.PdfResources.GetResourceNames ( PdfName  resType )
inlinevirtual

Gets the names of all resources of specified type.

Parameters
resType the resource type. Should be PdfName.ColorSpace , PdfName.ExtGState , PdfName.Pattern , PdfName.Shading , PdfName.XObject , PdfName.Font.
Returns
set of resources name of corresponding type. May be empty. Will be empty in case of incorrect resource type.

◆ GetResourceObject()

virtual PdfObject iText.Kernel.Pdf.PdfResources.GetResourceObject ( PdfName  resType,
PdfName  resName 
)
inlinevirtual

Get the PdfObject object with specified type and name.

Parameters
resType the resource type. Should be PdfName.ColorSpace , PdfName.ExtGState , PdfName.Pattern , PdfName.Shading , PdfName.XObject , PdfName.Font.
resName the name of the resource object.
Returns
the PdfObject with specified name in the resources of specified type or null in case of incorrect type or missing resource with such name.

◆ IsWrappedObjectMustBeIndirect()

override bool iText.Kernel.Pdf.PdfResources.IsWrappedObjectMustBeIndirect ( )
inlinepackagevirtual

Defines if the object behind this wrapper must be an indirect object in the resultant document.

Defines if the object behind this wrapper must be an indirect object in the resultant document.

If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.

Return value of this method shouldn't depend on any logic, it should return always true or false.

Returns
true if in the resultant document the object behind the wrapper must be indirect, otherwise false.

Implements iText.Kernel.Pdf.PdfObjectWrapper< PdfDictionary >.

◆ SetDefaultCmyk()

virtual void iText.Kernel.Pdf.PdfResources.SetDefaultCmyk ( PdfColorSpace  defaultCs )
inlinevirtual

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

Parameters
defaultCs the color space to set.

◆ SetDefaultGray()

virtual void iText.Kernel.Pdf.PdfResources.SetDefaultGray ( PdfColorSpace  defaultCs )
inlinevirtual

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

Parameters
defaultCs the color space to set.

◆ SetDefaultRgb()

virtual void iText.Kernel.Pdf.PdfResources.SetDefaultRgb ( PdfColorSpace  defaultCs )
inlinevirtual

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

Parameters
defaultCs the color space to set.

◆ SetModified()

override PdfObjectWrapper<PdfDictionary> iText.Kernel.Pdf.PdfResources.SetModified ( )
inlinevirtual

◆ SetProcSet()

virtual void iText.Kernel.Pdf.PdfResources.SetProcSet ( PdfArray  array )
inlinevirtual

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

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

Parameters
array the array of predefined procedure set names to be set.