Class PdfImageXObject
A wrapper for Image XObject.
public class PdfImageXObject : PdfXObject
- Inheritance
-
PdfImageXObject
- Inherited Members
Remarks
A wrapper for Image XObject. ISO 32000-1, 8.9 Images.
Constructors
PdfImageXObject(ImageData)
Creates Image XObject by image.
public PdfImageXObject(ImageData image)
Parameters
PdfImageXObject(ImageData, PdfImageXObject)
Creates Image XObject by image.
public PdfImageXObject(ImageData image, PdfImageXObject imageMask)
Parameters
image
ImageDataImageData with actual image data.
imageMask
PdfImageXObjectPdfImageXObject with image mask.
PdfImageXObject(PdfStream)
Create PdfImageXObject instance by PdfStream.
public PdfImageXObject(PdfStream pdfStream)
Parameters
Remarks
Create PdfImageXObject instance by PdfStream. Note, this constructor doesn't perform any additional checks
- See Also
Methods
CopyTo(PdfDocument)
Copy Image XObject to the specified document.
public virtual PdfImageXObject CopyTo(PdfDocument document)
Parameters
document
PdfDocumenttarget document
Returns
- PdfImageXObject
just created instance of PdfImageXObject.
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.
public override void Flush()
Remarks
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
MakeIndirect(PdfDocument).
For example: wrapperInstance.makeIndirect(document).flush();
Note, that not every wrapper require this, only those that have such warning in documentation.
GetHeight()
Gets height of image,
Height
key.
public override float GetHeight()
Returns
- float
float value.
GetImageBytes()
Gets decoded image bytes.
public virtual byte[] GetImageBytes()
Returns
- byte[]
byte array.
GetImageBytes(bool)
Gets image bytes.
public virtual byte[] GetImageBytes(bool decoded)
Parameters
Returns
- byte[]
byte array.
Remarks
Gets image bytes. Note, DCTDecode , JBIG2Decode and JPXDecode filters will be ignored.
GetWidth()
Gets width of image,
Width
key.
public override float GetWidth()
Returns
- float
float value.
IdentifyImageFileExtension()
Identifies recommended file extension to store the bytes of this PdfImageXObject.
public virtual string IdentifyImageFileExtension()
Returns
Remarks
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().
- See Also
IdentifyImageType()
Identifies the type of the image that is stored in the bytes of this PdfImageXObject.
public virtual ImageType IdentifyImageType()
Returns
- ImageType
the identified type of image
Remarks
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 PNG as we lose this information when converting a PNG image into something that can be put into a PDF file. The possible values are: JPEG , JPEG2000 , JBIG2 , TIFF , PNG
Put(PdfName, PdfObject)
Puts the value into Image XObject dictionary and associates it with the specified key.
public virtual PdfImageXObject Put(PdfName key, PdfObject value)
Parameters
key
PdfNamekey to insert or to override
value
PdfObjectthe value to associate with the specified key
Returns
- PdfImageXObject
object itself.
Remarks
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.