Skip to main content
Skip table of contents

Image

Image Public class

Description

An Image is the representation of a graphic element (JPEG, PNG or GIF) that has to be inserted into the document

Diagram

  flowchart LR
  classDef interfaceStyle stroke-dasharray: 5 5;
  classDef abstractStyle stroke-width:4px
  subgraph iTextSharp.text
  iTextSharp.text.Image[[Image]]
  class iTextSharp.text.Image abstractStyle;
  iTextSharp.text.Rectangle[[Rectangle]]
  end
  subgraph iTextSharp.text.api
  iTextSharp.text.api.IIndentable[[IIndentable]]
  class iTextSharp.text.api.IIndentable interfaceStyle;
  iTextSharp.text.api.ISpaceable[[ISpaceable]]
  class iTextSharp.text.api.ISpaceable interfaceStyle;
  end
  subgraph iTextSharp.text.pdf.interfaces
  iTextSharp.text.pdf.interfaces.IAccessibleElement[[IAccessibleElement]]
  class iTextSharp.text.pdf.interfaces.IAccessibleElement interfaceStyle;
  iTextSharp.text.pdf.interfaces.IAlternateDescription[[IAlternateDescription]]
  class iTextSharp.text.pdf.interfaces.IAlternateDescription interfaceStyle;
  end
iTextSharp.text.api.IIndentable --> iTextSharp.text.Image
iTextSharp.text.api.ISpaceable --> iTextSharp.text.Image
iTextSharp.text.pdf.interfaces.IAccessibleElement --> iTextSharp.text.Image
iTextSharp.text.pdf.interfaces.IAlternateDescription --> iTextSharp.text.Image
iTextSharp.text.Rectangle --> iTextSharp.text.Image

Members

Properties

Public properties
TypeNameMethods
floatAbsoluteX
Returns the absolute X position.
get
floatAbsoluteY
Returns the absolute Y position.
get
PdfDictionaryAdditionalget, set
intAlignment
Get/set the alignment for the image.
get, set
stringAlt
Get/set the alternative text for the image.
get, set
AnnotationAnnotation
Get/set the annotation.
get, set
intBpc
Gets the bpc for the image.
get
intColorTransformget, set
intColorspace
Gets the colorspace for the image.
get
intCompressionLevelget, set
boolDeflatedget, set
PdfIndirectReferenceDirectReferenceget, set
intDpiX
Gets the dots-per-inch in the X direction. Returns 0 if not available.
get
intDpiY
Gets the dots-per-inch in the Y direction. Returns 0 if not available.
get
AccessibleElementIdIDget, set
ImageImageMask
Get/set the explicit masking.
get, set
floatIndentationLeftget, set
floatIndentationRightget, set
floatInitialRotationget, set
boolInterpolation
Sets the image interpolation. Image interpolation attempts to
produce a smooth transition between adjacent sample values.
get, set
boolInverted
Inverts the meaning of the bits of a mask.
get, set
boolIsInlineget
IPdfOCGLayerget, set
longMySerialId
returns serial id for this object
get
byte``[]OriginalDataget, set
intOriginalTypeget, set
floatPaddingTopget, set
floatPlainHeight
Gets the plain height of the image.
get
floatPlainWidth
Gets the plain width of the image.
get
byte``[]RawData
Gets the raw data for the image.
get
PdfNameRoleget, set
floatRotation
Sets the rotation of the image in radians.
set
floatRotationDegrees
Sets the rotation of the image in degrees.
set
boolScaleToFitHeightget, set
boolScaleToFitLineWhenOverflowget, set
floatScaledHeight
Gets the scaled height of the image.
get
floatScaledWidth
Gets the scaled width of the image.
get
boolSmaskget, set
floatSpacingAfterget, set
floatSpacingBeforeget, set
ICC_ProfileTagICCget, set
PdfTemplateTemplateData
Get/set the template to be used as an image.
get, set
int``[]Transparency
Returns the transparency.
get, set
intType
Returns the type.
get
UriUrl
Gets the string-representation of the reference to the image.
get, set
floatWidthPercentageget, set
floatXYRatioget, set

Methods

Public Static methods
ReturnsName
ImageGetInstance(...)
Gets an instance of an Image.
Protected Static methods
ReturnsName
longGetSerialId()
generates new serial id
Public methods
ReturnsName
PdfObjectGetAccessibleAttribute(PdfName key)
Dictionary<PdfName, PdfObject>GetAccessibleAttributes()
floatGetImageRotation()
float``[]GetMatrix(...)
Returns the transformation matrix of the image.
boolHasAbsolutePosition()
Checks if the Images has to be added at an absolute position.
boolHasAbsoluteX()
Checks if the Images has to be added at an absolute X position.
boolHasICCProfile()
boolIsImgRaw()
Returns true if the image is a ImgRaw-object.
boolIsImgTemplate()
Returns true if the image is an ImgTemplate-object.
boolIsJpeg()
Returns true if the image is a Jpeg-object.
boolIsMask()
Returns true if this Image is a mask.
boolIsMaskCandidate()
Returns true if this Image has the
requisites to be a mask.
boolIsNestable()
voidMakeMask()
Make this Image a mask.
voidScaleAbsolute(...)
Scale the image to the dimensions of the rectangle
voidScaleAbsoluteHeight(float newHeight)
Scale the image to an absolute height.
voidScaleAbsoluteWidth(float newWidth)
Scale the image to an absolute width.
voidScalePercent(...)
Scale the image to a certain percentage.
voidScaleToFit(...)
Scales the images to the dimensions of the rectangle.
voidSetAbsolutePosition(float absoluteX, float absoluteY)
Sets the absolute position of the Image.
voidSetAccessibleAttribute(PdfName key, PdfObject value)
voidSetDpi(int dpiX, int dpiY)
voidSimplifyColorspace()

Details

Summary

An Image is the representation of a graphic element (JPEG, PNG or GIF) that has to be inserted into the document

Inheritance

Constructors

Image [1/2]

Source code

public Image(Uri url)
Arguments
TypeNameDescription
Uriurlthe URL where the image can be found.
Summary

Constructs an Image-object, using an url.

Image [2/2]

Source code

public Image(Image image)
Arguments
TypeNameDescription
Imageimageanother Image object.
Summary

Constructs an Image object duplicate.

Methods

GetInstance [1/18]

Source code

public static Image GetInstance(Image image)
Arguments
TypeNameDescription
Imageimagean Image
Summary

Gets an instance of an Image.

Returns

an object of type Gif, Jpeg or Png

GetInstance [2/18]

Source code

public static Image GetInstance(Uri url)
Arguments
TypeNameDescription
Uriurlan URL
Summary

Gets an instance of an Image.

Returns

an object of type Gif, Jpeg or Png

GetInstance [3/18]

Source code

public static Image GetInstance(Uri url, bool recoverFromImageError)
Arguments
TypeNameDescription
Uriurlan URL
boolrecoverFromImageError
Summary

Gets an instance of an Image.

Returns

an object of type Gif, Jpeg or Png

GetInstance [4/18]

Source code

public static Image GetInstance(Stream s)
Arguments
TypeNameDescription
Streams
GetInstance [5/18]

Source code

public static Image GetInstance(string filename, bool recoverFromImageError)
Arguments
TypeNameDescription
stringfilename
boolrecoverFromImageError
GetInstance [6/18]

Source code

public static Image GetInstance(byte[] imgb)
Arguments
TypeNameDescription
byte``[]imgb
GetInstance [7/18]

Source code

public static Image GetInstance(byte[] imgb, bool recoverFromImageError)
Arguments
TypeNameDescription
byte``[]imgb
boolrecoverFromImageError
Summary

Gets an instance of an Image.

Returns

an object of type Gif, Jpeg or Png

GetInstance [8/18]

Source code

public static Image GetInstance(Image image, BaseColor color, bool forceBW)
Arguments
TypeNameDescription
Imageimagethe System.Drawing.Image to convert
BaseColorcolorif different from null the transparency
pixels are replaced by this color
boolforceBWif true the image is treated as black and white
Summary

Gets an instance of an Image from a System.Drwaing.Image.

Returns

an object of type ImgRaw

GetInstance [9/18]

Source code

public static Image GetInstance(Image image, ImageFormat format)
Arguments
TypeNameDescription
Imageimage
ImageFormatformat
Summary

Converts a .NET image to a Native(PNG, JPG, GIF, WMF) image

Returns
GetInstance [10/18]

Source code

public static Image GetInstance(Image image, BaseColor color)
Arguments
TypeNameDescription
Imageimagethe System.Drawing.Image to convert
BaseColorcolorif different from null the transparency
pixels are replaced by this color
Summary

Gets an instance of an Image from a System.Drawing.Image.

Returns

an object of type ImgRaw

GetInstance [11/18]

Source code

public static Image GetInstance(string filename)
Arguments
TypeNameDescription
stringfilenamea filename
Summary

Gets an instance of an Image.

Returns

an object of type Gif, Jpeg or Png

GetInstance [12/18]

Source code

public static Image GetInstance(int width, int height, int components, int bpc, byte[] data)
Arguments
TypeNameDescription
intwidththe width of the image in pixels
intheightthe height of the image in pixels
intcomponents1,3 or 4 for GrayScale, RGB and CMYK
intbpcbits per component
byte``[]datathe image data
Summary

Gets an instance of an Image in raw mode.

Returns

an object of type ImgRaw

GetInstance [13/18]

Source code

public static Image GetInstance(int width, int height, byte[] data, byte[] globals)
Arguments
TypeNameDescription
intwidth
intheight
byte``[]data
byte``[]globals
GetInstance [14/18]

Source code

public static Image GetInstance(PRIndirectReference iref)
Arguments
TypeNameDescription
PRIndirectReferenceiref
GetInstance [15/18]

Source code

public static Image GetInstance(PdfTemplate template)
Arguments
TypeNameDescription
PdfTemplatetemplate
Summary

Gets an instance of an Image in raw mode.

Returns
GetInstance [16/18]

Source code

public static Image GetInstance(int width, int height, bool reverseBits, int typeCCITT, int parameters, byte[] data)
Arguments
TypeNameDescription
intwidththe width of the image in pixels
intheightthe height of the image in pixels
boolreverseBits
inttypeCCITT
intparameters
byte``[]data
Summary

Gets an instance of an Image in raw mode.

Returns
GetInstance [17/18]

Source code

public static Image GetInstance(int width, int height, bool reverseBits, int typeCCITT, int parameters, byte[] data, int[] transparency)
Arguments
TypeNameDescription
intwidth
intheight
boolreverseBits
inttypeCCITT
intparameters
byte``[]data
int``[]transparency
Summary
Returns
GetInstance [18/18]

Source code

public static Image GetInstance(int width, int height, int components, int bpc, byte[] data, int[] transparency)
Arguments
TypeNameDescription
intwidththe width of the image in pixels
intheightthe height of the image in pixels
intcomponents1,3 or 4 for GrayScale, RGB and CMYK
intbpcbits per component
byte``[]datathe image data
int``[]transparencytransparency information in the Mask format of the
image dictionary
Summary

Gets an instance of an Image in raw mode.

Returns

an object of type ImgRaw

SetAbsolutePosition

Source code

public virtual void SetAbsolutePosition(float absoluteX, float absoluteY)
Arguments
TypeNameDescription
floatabsoluteX
floatabsoluteY
Summary

Sets the absolute position of the Image.

ScaleAbsolute [1/2]

Source code

public virtual void ScaleAbsolute(Rectangle rectangle)
Arguments
TypeNameDescription
Rectanglerectangledimensions to scale the Image
Summary

Scale the image to the dimensions of the rectangle

ScaleAbsolute [2/2]

Source code

public virtual void ScaleAbsolute(float newWidth, float newHeight)
Arguments
TypeNameDescription
floatnewWidththe new width
floatnewHeightthe new height
Summary

Scale the image to an absolute width and an absolute height.

ScaleAbsoluteWidth

Source code

public virtual void ScaleAbsoluteWidth(float newWidth)
Arguments
TypeNameDescription
floatnewWidththe new width
Summary

Scale the image to an absolute width.

ScaleAbsoluteHeight

Source code

public virtual void ScaleAbsoluteHeight(float newHeight)
Arguments
TypeNameDescription
floatnewHeightthe new height
Summary

Scale the image to an absolute height.

ScalePercent [1/2]

Source code

public virtual void ScalePercent(float percent)
Arguments
TypeNameDescription
floatpercentthe scaling percentage
Summary

Scale the image to a certain percentage.

ScalePercent [2/2]

Source code

public virtual void ScalePercent(float percentX, float percentY)
Arguments
TypeNameDescription
floatpercentXthe scaling percentage of the width
floatpercentYthe scaling percentage of the height
Summary

Scale the width and height of an image to a certain percentage.

ScaleToFit [1/2]

Source code

public virtual void ScaleToFit(Rectangle rectangle)
Arguments
TypeNameDescription
Rectanglerectanglethe dimensions to fit
Summary

Scales the images to the dimensions of the rectangle.

ScaleToFit [2/2]

Source code

public virtual void ScaleToFit(float fitWidth, float fitHeight)
Arguments
TypeNameDescription
floatfitWidththe width to fit
floatfitHeightthe height to fit
Summary

Scales the image so that it fits a certain width and height.

GetImageRotation

Source code

public virtual float GetImageRotation()
HasAbsolutePosition

Source code

public virtual bool HasAbsolutePosition()
Summary

Checks if the Images has to be added at an absolute position.

Returns

a bool

HasAbsoluteX

Source code

public virtual bool HasAbsoluteX()
Summary

Checks if the Images has to be added at an absolute X position.

Returns

a bool

IsNestable

Source code

public override bool IsNestable()
IsJpeg

Source code

public virtual bool IsJpeg()
Summary

Returns true if the image is a Jpeg-object.

Returns

a bool

IsImgRaw

Source code

public virtual bool IsImgRaw()
Summary

Returns true if the image is a ImgRaw-object.

Returns

a bool

IsImgTemplate

Source code

public virtual bool IsImgTemplate()
Summary

Returns true if the image is an ImgTemplate-object.

Returns

a bool

GetMatrix [1/2]

Source code

public virtual float GetMatrix()
Summary

Returns the transformation matrix of the image.

GetMatrix [2/2]

Source code

public virtual float GetMatrix(float scalePercentage)
Arguments
TypeNameDescription
floatscalePercentage
GetSerialId

Source code

protected static long GetSerialId()
Summary

generates new serial id

SetDpi

Source code

public virtual void SetDpi(int dpiX, int dpiY)
Arguments
TypeNameDescription
intdpiX
intdpiY
IsMaskCandidate

Source code

public virtual bool IsMaskCandidate()
Summary

Returns true if this Image has the requisites to be a mask.

Returns

true if this Image can be a mask

MakeMask

Source code

public virtual void MakeMask()
Summary

Make this Image a mask.

IsMask

Source code

public virtual bool IsMask()
Summary

Returns true if this Image is a mask.

Returns

true if this Image is a mask

HasICCProfile

Source code

public virtual bool HasICCProfile()
SimplifyColorspace

Source code

public virtual void SimplifyColorspace()
GetAccessibleAttribute

Source code

public virtual PdfObject GetAccessibleAttribute(PdfName key)
Arguments
TypeNameDescription
PdfNamekey
SetAccessibleAttribute

Source code

public virtual void SetAccessibleAttribute(PdfName key, PdfObject value)
Arguments
TypeNameDescription
PdfNamekey
PdfObjectvalue
GetAccessibleAttributes

Source code

public virtual Dictionary<PdfName, PdfObject> GetAccessibleAttributes()

Properties

Rotation
public float Rotation { set; }
Summary

Sets the rotation of the image in radians.

RotationDegrees
public virtual float RotationDegrees { set; }
Summary

Sets the rotation of the image in degrees.

Annotation
public virtual Annotation Annotation { get; set; }
Summary

Get/set the annotation.

Value

the Annotation

Bpc
public virtual int Bpc { get; }
Summary

Gets the bpc for the image.

Remarks

this only makes sense for Images of the type RawImage.

Value

a bpc value

RawData
public virtual byte RawData { get; }
Summary

Gets the raw data for the image.

Remarks

this only makes sense for Images of the type RawImage.

Value

the raw data

TemplateData
public virtual PdfTemplate TemplateData { get; set; }
Summary

Get/set the template to be used as an image.

Remarks

this only makes sense for Images of the type ImgTemplate.

Value

the template

AbsoluteX
public virtual float AbsoluteX { get; }
Summary

Returns the absolute X position.

Value

a position

AbsoluteY
public virtual float AbsoluteY { get; }
Summary

Returns the absolute Y position.

Value

a position

Type
public override int Type { get; }
Summary

Returns the type.

Value

a type

Url
public virtual Uri Url { get; set; }
Summary

Gets the string-representation of the reference to the image.

Value

a string

Alignment
public virtual int Alignment { get; set; }
Summary

Get/set the alignment for the image.

Value

a value

Alt
public virtual string Alt { get; set; }
Summary

Get/set the alternative text for the image.

Value

a string

ScaledWidth
public virtual float ScaledWidth { get; }
Summary

Gets the scaled width of the image.

Value

a value

ScaledHeight
public virtual float ScaledHeight { get; }
Summary

Gets the scaled height of the image.

Value

a value

Colorspace
public virtual int Colorspace { get; }
Summary

Gets the colorspace for the image.

Remarks

this only makes sense for Images of the type Jpeg.

Value

a colorspace value

ColorTransform
public virtual int ColorTransform { get; set; }
Transparency
public virtual int Transparency { get; set; }
Summary

Returns the transparency.

Value

the transparency

PlainWidth
public virtual float PlainWidth { get; }
Summary

Gets the plain width of the image.

Value

a value

PlainHeight
public virtual float PlainHeight { get; }
Summary

Gets the plain height of the image.

Value

a value

MySerialId
public virtual long MySerialId { get; }
Summary

returns serial id for this object

DpiX
public virtual int DpiX { get; }
Summary

Gets the dots-per-inch in the X direction. Returns 0 if not available.

Value

the dots-per-inch in the X direction

DpiY
public virtual int DpiY { get; }
Summary

Gets the dots-per-inch in the Y direction. Returns 0 if not available.

Value

the dots-per-inch in the Y direction

ImageMask
public virtual Image ImageMask { get; set; }
Summary

Get/set the explicit masking.

Value

the explicit masking

Inverted
public virtual bool Inverted { get; set; }
Summary

Inverts the meaning of the bits of a mask.

Value

true to invert the meaning of the bits of a mask

Interpolation
public virtual bool Interpolation { get; set; }
Summary

Sets the image interpolation. Image interpolation attempts to produce a smooth transition between adjacent sample values.

Value

New value of property interpolation.

TagICC
public virtual ICC_Profile TagICC { get; set; }
Deflated
public virtual bool Deflated { get; set; }
Additional
public virtual PdfDictionary Additional { get; set; }
Smask
public virtual bool Smask { get; set; }
XYRatio
public virtual float XYRatio { get; set; }
IndentationLeft
public virtual float IndentationLeft { get; set; }
IndentationRight
public virtual float IndentationRight { get; set; }
OriginalType
public virtual int OriginalType { get; set; }
OriginalData
public virtual byte OriginalData { get; set; }
SpacingBefore
public virtual float SpacingBefore { get; set; }
SpacingAfter
public virtual float SpacingAfter { get; set; }
PaddingTop
public virtual float PaddingTop { get; set; }
WidthPercentage
public virtual float WidthPercentage { get; set; }
ScaleToFitLineWhenOverflow
public virtual bool ScaleToFitLineWhenOverflow { get; set; }
ScaleToFitHeight
public virtual bool ScaleToFitHeight { get; set; }
Layer
public virtual IPdfOCG Layer { get; set; }
InitialRotation
public virtual float InitialRotation { get; set; }
DirectReference
public virtual PdfIndirectReference DirectReference { get; set; }
CompressionLevel
public virtual int CompressionLevel { get; set; }
Role
public virtual PdfName Role { get; set; }
ID
public virtual AccessibleElementId ID { get; set; }
IsInline
public virtual bool IsInline { get; }

Generated with ModularDoc

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.