iText 7 7.1.9 API
iText.Kernel.Pdf.Xobject.PdfImageXObject Class Reference

A wrapper for Image XObject. More...

Inheritance diagram for iText.Kernel.Pdf.Xobject.PdfImageXObject:
iText.Kernel.Pdf.Xobject.PdfXObject iText.Kernel.Pdf.PdfObjectWrapper< PdfStream >

Public Member Functions

  PdfImageXObject (ImageData image)
  Creates Image XObject by image. More...
 
  PdfImageXObject (ImageData image, iText.Kernel.Pdf.Xobject.PdfImageXObject imageMask)
  Creates Image XObject by image. More...
 
  PdfImageXObject (PdfStream pdfStream)
  Create PdfImageXObject instance by iText.Kernel.Pdf.PdfStream. More...
 
override float  GetWidth ()
  Gets width of image, Width key. More...
 
override float  GetHeight ()
  Gets height of image, Height key. More...
 
override void  Flush ()
  To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. More...
 
virtual iText.Kernel.Pdf.Xobject.PdfImageXObject  CopyTo (PdfDocument document)
  Copy Image XObject to the specified document. More...
 
virtual byte[]  GetImageBytes ()
  Gets decoded image bytes. More...
 
virtual byte[]  GetImageBytes (bool decoded)
  Gets image bytes. More...
 
virtual ImageType  IdentifyImageType ()
  Identifies the type of the image that is stored in the bytes of this PdfImageXObject. More...
 
virtual String  IdentifyImageFileExtension ()
  Identifies recommended file extension to store the bytes of this PdfImageXObject. More...
 
virtual iText.Kernel.Pdf.Xobject.PdfImageXObject  Put (PdfName key, PdfObject value)
  Puts the value into Image XObject dictionary and associates it with the specified key. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.Xobject.PdfXObject
virtual void  SetLayer (IPdfOCG layer)
  Sets the layer this XObject belongs to. More...
 
virtual void  AddAssociatedFile (PdfFileSpec fs)
  Adds file associated with PDF XObject and identifies the relationship between them. More...
 
virtual PdfArray  GetAssociatedFiles (bool create)
  Returns files associated with XObject. More...
 
- Public Member Functions inherited from iText.Kernel.Pdf.PdfObjectWrapper< PdfStream >
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 iText.Kernel.Pdf.PdfObjectWrapper< T >  SetModified ()
 
virtual bool  IsFlushed ()
 

Additional Inherited Members

- Static Public Member Functions inherited from iText.Kernel.Pdf.Xobject.PdfXObject
static iText.Kernel.Pdf.Xobject.PdfXObject  MakeXObject (PdfStream stream)
  Create PdfFormXObject or PdfImageXObject by iText.Kernel.Pdf.PdfStream. More...
 

Detailed Description

A wrapper for Image XObject.

A wrapper for Image XObject. ISO 32000-1, 8.9 Images.

Constructor & Destructor Documentation

◆ PdfImageXObject() [1/3]

iText.Kernel.Pdf.Xobject.PdfImageXObject.PdfImageXObject ( ImageData  image )
inline

Creates Image XObject by image.

Parameters
image

iText.IO.Image.ImageData with actual image data.

◆ PdfImageXObject() [2/3]

iText.Kernel.Pdf.Xobject.PdfImageXObject.PdfImageXObject ( ImageData  image,
iText.Kernel.Pdf.Xobject.PdfImageXObject  imageMask 
)
inline

Creates Image XObject by image.

Parameters
image

iText.IO.Image.ImageData with actual image data.

Parameters
imageMask

PdfImageXObject with image mask.

◆ PdfImageXObject() [3/3]

iText.Kernel.Pdf.Xobject.PdfImageXObject.PdfImageXObject ( PdfStream  pdfStream )
inline

Create PdfImageXObject instance by iText.Kernel.Pdf.PdfStream.

Create PdfImageXObject instance by iText.Kernel.Pdf.PdfStream. Note, this constructor doesn't perform any additional checks

Parameters
pdfStream

iText.Kernel.Pdf.PdfStream with Image XObject.

See also
PdfXObject.MakeXObject(iText.Kernel.Pdf.PdfStream)

Member Function Documentation

◆ CopyTo()

virtual iText.Kernel.Pdf.Xobject.PdfImageXObject iText.Kernel.Pdf.Xobject.PdfImageXObject.CopyTo ( PdfDocument  document )
inlinevirtual

Copy Image XObject to the specified document.

Parameters
document target document
Returns
just created instance of PdfImageXObject.

◆ Flush()

override void iText.Kernel.Pdf.Xobject.PdfImageXObject.Flush ( )
inlinevirtual

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference.

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly call iText.Kernel.Pdf.PdfObjectWrapper<T>.MakeIndirect(iText.Kernel.Pdf.PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note, that not every wrapper require this, only those that have such warning in documentation.

Reimplemented from iText.Kernel.Pdf.PdfObjectWrapper< PdfStream >.

◆ GetHeight()

override float iText.Kernel.Pdf.Xobject.PdfImageXObject.GetHeight ( )
inlinevirtual

Gets height of image, Height key.

Returns
float value.

Reimplemented from iText.Kernel.Pdf.Xobject.PdfXObject.

◆ GetImageBytes() [1/2]

virtual byte [] iText.Kernel.Pdf.Xobject.PdfImageXObject.GetImageBytes ( )
inlinevirtual

Gets decoded image bytes.

Returns
byte array.

◆ GetImageBytes() [2/2]

virtual byte [] iText.Kernel.Pdf.Xobject.PdfImageXObject.GetImageBytes ( bool  decoded )
inlinevirtual

Gets image bytes.

Gets image bytes. Note, iText.Kernel.Pdf.PdfName.DCTDecode , iText.Kernel.Pdf.PdfName.JBIG2Decode and iText.Kernel.Pdf.PdfName.JPXDecode filters will be ignored.

Parameters
decoded if true , decodes stream bytes.
Returns
byte array.

◆ GetWidth()

override float iText.Kernel.Pdf.Xobject.PdfImageXObject.GetWidth ( )
inlinevirtual

Gets width of image, Width key.

Returns
float value.

Reimplemented from iText.Kernel.Pdf.Xobject.PdfXObject.

◆ IdentifyImageFileExtension()

virtual String iText.Kernel.Pdf.Xobject.PdfImageXObject.IdentifyImageFileExtension ( )
inlinevirtual

Identifies recommended file extension to store the bytes of this PdfImageXObject.

Identifies recommended file extension to store the bytes of this PdfImageXObject. Possible values are: 'png', 'jpg', 'jp2', 'tif', 'jbig2'. This extension can later be used together with the result of GetImageBytes().

Returns
a System.String with recommended file extension
See also
IdentifyImageType()

◆ IdentifyImageType()

virtual ImageType iText.Kernel.Pdf.Xobject.PdfImageXObject.IdentifyImageType ( )
inlinevirtual

Identifies the type of the image that is stored in the bytes of this PdfImageXObject.

Identifies the type of the image that is stored in the bytes of this PdfImageXObject. Note that this has nothing to do with the original type of the image. For instance, the return value of this method will never be iText.IO.Image.ImageType.PNG as we loose this information when converting a PNG image into something that can be put into a PDF file. The possible values are: iText.IO.Image.ImageType.JPEG , iText.IO.Image.ImageType.JPEG2000 , iText.IO.Image.ImageType.JBIG2 , iText.IO.Image.ImageType.TIFF , iText.IO.Image.ImageType.PNG

Returns
the identified type of image

◆ Put()

virtual iText.Kernel.Pdf.Xobject.PdfImageXObject iText.Kernel.Pdf.Xobject.PdfImageXObject.Put ( PdfName  key,
PdfObject  value 
)
inlinevirtual

Puts the value into Image XObject dictionary and associates it with the specified key.

Puts the value into Image XObject dictionary and associates it with the specified key. If the key is already present, it will override the old value with the specified one.

Parameters
key key to insert or to override
value the value to associate with the specified key
Returns
object itself.