Class ImageObject
Represents an image object embedded within a PDF page.
This object allows you to modify the image's content, position, scale, and rotation. Transformations are applied immediately when a property is set.
Inheritance
Implements
Namespace: IronSoftware
Assembly: IronPdf.dll
Syntax
public class ImageObject : Object, IPdfImageObject, IPdfDocumentObject, IPdfDocumentObject, IDocumentObject, IDocumentImageObject, IBoundedPdfDocumentObject, IBounded, ITransformable, ICloneable, IJsonSerializable
Remarks
Transformation Logic:
-
Scale & Translate (Incremental):
These properties operate on a "Last Value Applied" basis relative to the object's original state.
Setting Scale to (0.5, 0.5) twice will NOT result in a 0.25 scale.
It effectively means "Make the object 50% of its original size".To shrink it further, you must calculate the new relative target (e.g., 0.25) and apply that.
-
Rotation (Absolute):
Rotation is always absolute. Setting Rotation to 45 degrees sets the object to 45 degrees (Clockwise),
regardless of its previous rotation. It does not add 45 degrees to the current angle.
Fields
_Image
Declaration
protected IAnyImage _Image
Field Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.IAnyImage |
_Rotation
Declaration
protected double _Rotation
Field Value
| Type | Description |
|---|---|
| System.Double |
_Scale
Declaration
protected PointF _Scale
Field Value
| Type | Description |
|---|---|
| System.Drawing.PointF |
_Translate
Declaration
protected PointF _Translate
Field Value
| Type | Description |
|---|---|
| System.Drawing.PointF |
Properties
BoundingBox
Declaration
public RectangleF BoundingBox { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.RectangleF |
Client
Pdf client
Declaration
public IPdfClient Client { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Pdfium.IPdfClient |
DocumentId
Declaration
public IDocumentId DocumentId { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.Pdf.IDocumentId |
Image
Declaration
public IAnyImage Image { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.IAnyImage |
ImageChanged
Flag indicating that the image has changed
Declaration
public bool ImageChanged { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Matrix
Declaration
public MatrixStruct Matrix { get; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.MatrixStruct |
ObjNum
Declaration
public uint ObjNum { get; set; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
PageIndex
Declaration
public uint PageIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
Rotation
Gets or sets the absolute rotation angle of the image in degrees.
Declaration
public double Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | A System.Double representing the rotation angle in degrees. Positive values rotate Clockwise. |
Remarks
Absolute Rotation: Unlike Scale/Translate, this value is absolute. If the image is currently at 90 degrees, setting this to 0 will reset it to upright.
Pivot: Rotation occurs around the bottom-left corner of the image's bounding box.
Scale
Gets or sets the scaling factor of the image relative to its original size.
Declaration
public PointF Scale { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.PointF | A System.Drawing.PointF where X and Y represent the horizontal and vertical scaling factors. Default is (1.0, 1.0). |
Remarks
Behavior: Setting this property updates the image size immediately.
Example:
image.Scale = new PointF(0.5f, 0.5f); This reduces the image to half width/height.
Warning: Setting Scale to 0.0 or extremely small values (near epsilon) is internally clamped to 1.0 or a safe minimum to prevent division-by-zero errors or disappearing objects.
Translate
Gets or sets the translation (position offset) of the image from its original location.
Declaration
public PointF Translate { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.PointF | A System.Drawing.PointF representing the delta X and delta Y in PDF user space units (usually points). |
Remarks
Behavior: This moves the image relative to its starting position found when the object was loaded.
Example:
image.Translate = new PointF(100f, 50f); This moves the image 100 points right and 50 points up
(PDF coordinate system usually originates at bottom-left).
ZOrder
Declaration
public RelativeZOrder ZOrder { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.RelativeZOrder |
ZPosition
Declaration
public long ZPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Methods
Clone()
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| System.Object |
ToJson()
Declaration
public string ToJson()
Returns
| Type | Description |
|---|---|
| System.String |