iText 5

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

Type

Name

Methods

float

AbsoluteX


Returns the absolute X position.

get

float

AbsoluteY


Returns the absolute Y position.

get

PdfDictionary

Additional

get, set

int

Alignment


Get/set the alignment for the image.

get, set

string

Alt


Get/set the alternative text for the image.

get, set

Annotation

Annotation


Get/set the annotation.

get, set

int

Bpc


Gets the bpc for the image.

get

int

ColorTransform

get, set

int

Colorspace


Gets the colorspace for the image.

get

int

CompressionLevel

get, set

bool

Deflated

get, set

PdfIndirectReference

DirectReference

get, set

int

DpiX


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

get

int

DpiY


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

get

AccessibleElementId

ID

get, set

Image

ImageMask


Get/set the explicit masking.

get, set

float

IndentationLeft

get, set

float

IndentationRight

get, set

float

InitialRotation

get, set

bool

Interpolation


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

get, set

bool

Inverted


Inverts the meaning of the bits of a mask.

get, set

bool

IsInline

get

IPdfOCG

Layer

get, set

long

MySerialId


returns serial id for this object

get

byte``[]

OriginalData

get, set

int

OriginalType

get, set

float

PaddingTop

get, set

float

PlainHeight


Gets the plain height of the image.

get

float

PlainWidth


Gets the plain width of the image.

get

byte``[]

RawData


Gets the raw data for the image.

get

PdfName

Role

get, set

float

Rotation


Sets the rotation of the image in radians.

set

float

RotationDegrees


Sets the rotation of the image in degrees.

set

bool

ScaleToFitHeight

get, set

bool

ScaleToFitLineWhenOverflow

get, set

float

ScaledHeight


Gets the scaled height of the image.

get

float

ScaledWidth


Gets the scaled width of the image.

get

bool

Smask

get, set

float

SpacingAfter

get, set

float

SpacingBefore

get, set

ICC_Profile

TagICC

get, set

PdfTemplate

TemplateData


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

get, set

int``[]

Transparency


Returns the transparency.

get, set

int

Type


Returns the type.

get

Uri

Url


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

get, set

float

WidthPercentage

get, set

float

XYRatio

get, set

Methods

Public Static methods

Returns

Name

Image

GetInstance

(...)
Gets an instance of an Image.

Protected Static methods

Returns

Name

long

GetSerialId

()
generates new serial id

Public methods

Returns

Name

PdfObject

GetAccessibleAttribute

(

PdfName

key)

Dictionary<

PdfName

,

PdfObject

>

GetAccessibleAttributes

()

float

GetImageRotation

()

float``[]

GetMatrix

(...)
Returns the transformation matrix of the image.

bool

HasAbsolutePosition

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

bool

HasAbsoluteX

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

bool

HasICCProfile

()

bool

IsImgRaw

()
Returns true if the image is a ImgRaw-object.

bool

IsImgTemplate

()
Returns true if the image is an ImgTemplate-object.

bool

IsJpeg

()
Returns true if the image is a Jpeg-object.

bool

IsMask

()
Returns true if this Image is a mask.

bool

IsMaskCandidate

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

bool

IsNestable

()

void

MakeMask

()
Make this Image a mask.

void

ScaleAbsolute

(...)
Scale the image to the dimensions of the rectangle

void

ScaleAbsoluteHeight

(float newHeight)
Scale the image to an absolute height.

void

ScaleAbsoluteWidth

(float newWidth)
Scale the image to an absolute width.

void

ScalePercent

(...)
Scale the image to a certain percentage.

void

ScaleToFit

(...)
Scales the images to the dimensions of the rectangle.

void

SetAbsolutePosition

(float absoluteX, float absoluteY)
Sets the absolute position of the Image.

void

SetAccessibleAttribute

(

PdfName

key,

PdfObject

value)

void

SetDpi

(int dpiX, int dpiY)

void

SimplifyColorspace

()

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

Type

Name

Description

Uri

url

the 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

Type

Name

Description

Image

image

another Image object.

Summary

Constructs an Image object duplicate.

Methods

GetInstance [1/18]

Source code

public static Image GetInstance(Image image)

Arguments

Type

Name

Description

Image

image

an 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

Type

Name

Description

Uri

url

an 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

Type

Name

Description

Uri

url

an URL

bool

recoverFromImageError

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

Type

Name

Description

Stream

s

GetInstance [5/18]

Source code

public static Image GetInstance(string filename, bool recoverFromImageError)

Arguments

Type

Name

Description

string

filename

bool

recoverFromImageError

GetInstance [6/18]

Source code

public static Image GetInstance(byte[] imgb)

Arguments

Type

Name

Description

byte``[]

imgb

GetInstance [7/18]

Source code

public static Image GetInstance(byte[] imgb, bool recoverFromImageError)

Arguments

Type

Name

Description

byte``[]

imgb

bool

recoverFromImageError

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

Type

Name

Description

Image

image

the System.Drawing.Image to convert

BaseColor

color

if different from null the transparency
pixels are replaced by this color

bool

forceBW

if 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

Type

Name

Description

Image

image

ImageFormat

format

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

Type

Name

Description

Image

image

the System.Drawing.Image to convert

BaseColor

color

if 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

Type

Name

Description

string

filename

a 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

Type

Name

Description

int

width

the width of the image in pixels

int

height

the height of the image in pixels

int

components

1,3 or 4 for GrayScale, RGB and CMYK

int

bpc

bits per component

byte``[]

data

the 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

Type

Name

Description

int

width

int

height

byte``[]

data

byte``[]

globals

GetInstance [14/18]

Source code

public static Image GetInstance(PRIndirectReference iref)

Arguments

Type

Name

Description

PRIndirectReference

iref

GetInstance [15/18]

Source code

public static Image GetInstance(PdfTemplate template)

Arguments

Type

Name

Description

PdfTemplate

template

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

Type

Name

Description

int

width

the width of the image in pixels

int

height

the height of the image in pixels

bool

reverseBits

int

typeCCITT

int

parameters

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

Type

Name

Description

int

width

int

height

bool

reverseBits

int

typeCCITT

int

parameters

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

Type

Name

Description

int

width

the width of the image in pixels

int

height

the height of the image in pixels

int

components

1,3 or 4 for GrayScale, RGB and CMYK

int

bpc

bits per component

byte``[]

data

the image data

int``[]

transparency

transparency 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

Type

Name

Description

float

absoluteX

float

absoluteY

Summary

Sets the absolute position of the Image.

ScaleAbsolute [1/2]

Source code

public virtual void ScaleAbsolute(Rectangle rectangle)

Arguments

Type

Name

Description

Rectangle

rectangle

dimensions 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

Type

Name

Description

float

newWidth

the new width

float

newHeight

the new height

Summary

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

ScaleAbsoluteWidth

Source code

public virtual void ScaleAbsoluteWidth(float newWidth)

Arguments

Type

Name

Description

float

newWidth

the new width

Summary

Scale the image to an absolute width.

ScaleAbsoluteHeight

Source code

public virtual void ScaleAbsoluteHeight(float newHeight)

Arguments

Type

Name

Description

float

newHeight

the new height

Summary

Scale the image to an absolute height.

ScalePercent [1/2]

Source code

public virtual void ScalePercent(float percent)

Arguments

Type

Name

Description

float

percent

the scaling percentage

Summary

Scale the image to a certain percentage.

ScalePercent [2/2]

Source code

public virtual void ScalePercent(float percentX, float percentY)

Arguments

Type

Name

Description

float

percentX

the scaling percentage of the width

float

percentY

the 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

Type

Name

Description

Rectangle

rectangle

the 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

Type

Name

Description

float

fitWidth

the width to fit

float

fitHeight

the 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

Type

Name

Description

float

scalePercentage

GetSerialId

Source code

protected static long GetSerialId()

Summary

generates new serial id

SetDpi

Source code

public virtual void SetDpi(int dpiX, int dpiY)

Arguments

Type

Name

Description

int

dpiX

int

dpiY

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

Type

Name

Description

PdfName

key

SetAccessibleAttribute

Source code

public virtual void SetAccessibleAttribute(PdfName key, PdfObject value)

Arguments

Type

Name

Description

PdfName

key

PdfObject

value

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