DOM.Elements.Graphics.Graphic
Represents a graphic element (image, shape, or other visual object) that can be placed within a document.
Theclass serves as the base for all visual elements in the VDocs DOM, providing common properties for visual styling, positioning, and transformation. Graphics can be positioned using: Absolute positioning (X/Y coordinates with optional units) Alignment-based positioning (centered, left, right, etc.) Mixed positioning (horizontal alignment with vertical absolute, or vice versa) All positioning and sizing properties are stored in aobject, which also handles rotation, margins, and text wrapping behavior.
26 members
Properties
Gets or sets the shading (background fill pattern) applied to the graphic.
Gets or sets the transformation properties for the graphic.
Theproperty consolidates all spatial and layout properties of the graphic, making it easy to manage the element's visual presentation.
Methods
EnsureTransform
EnsureTransformEnsures that theproperty is initialized.
EnsureTransformAndPosition
EnsureTransformAndPositionEnsures that bothandare initialized.
GetTransformationDescription
GetTransformationDescriptionReturns a string representation of the graphic's transformation properties.
Returns
A formatted string containing position, dimensions, rotation, and margins.
ResetTransformation
ResetTransformationResets all transformation settings (position, dimensions, rotation, margins) to their default (unset) state.
This is useful when you want to clear all positioning and sizing information and start fresh.
SetBehindDocument
SetBehindDocument(bool behindDoc)Sets whether the graphic should appear behind the document text.
When, the graphic serves as a background element with text overlaying it. When, the graphic overlays the text.
Parameters
- behindDoc
- to place the graphic behind text;to place it in front.
SetDimensions
2 overloadsSetDimensions(double width, double height, Units units)Sets the dimensions (width and height) of the graphic.
Dimensions are stored in theproperty. The method automatically initializesif it is. Ifis, a newobject is created.
Parameters
- width
- Width of the graphic.
- height
- Height of the graphic.
- units
- Measurement unit for the dimensions (default: points).
SetDimensions(DocumentUnit width, DocumentUnit height)Sets the dimensions of the graphic using pre-configured DocumentUnit values.
This overload is useful when you have already createdinstances with specific units and want to reuse them for dimensions.
Parameters
- width
- Width as.
- height
- Height as.
SetDistanceFromText
SetDistanceFromText(double distance, Units units)Sets the distance from text for text wrapping.
This defines the spacing between the graphic and surrounding text when text wrapping is enabled.
Parameters
- distance
- Distance value.
- units
- Measurement unit for the distance (default: points).
SetMargin
3 overloadsSetMargin(double margin, Units units)Sets uniform margins around the graphic.
Margins define the space between the graphic and surrounding content. The method automatically initializesif it is.
Parameters
- margin
- Margin value to apply to all sides.
- units
- Measurement unit for the margin (default: points).
SetMargin(double top, double bottom, double left, double right, Units units)Sets individual margins for each side of the graphic.
This method allows asymmetric margins, which is useful for fine-tuning the spacing around the graphic.
Parameters
- top
- Top margin value.
- bottom
- Bottom margin value.
- left
- Left margin value.
- right
- Right margin value.
- units
- Measurement unit for the margins (default: points).
SetMargin(Margin margin)Sets individual margins using a pre-configuredobject.
Parameters
- margin
- The margin object containing all four margin values.
SetPosition
5 overloadsSetPosition(double x, double y, Units units)Sets the absolute position of the graphic using the specified coordinates and units.
This method configures the graphic for absolute positioning, which places the element at a fixed location relative to the page or margin reference. The method automatically initializesandproperties if they are, and ensures that absolute positioning mode is enabled (clearing any previous alignment-based positioning).
Parameters
- x
- Horizontal position value.
- y
- Vertical position value.
- units
- Measurement unit for the position values (default: points).
SetPosition(DocumentUnit x, DocumentUnit y)Sets the absolute position of the graphic using pre-configured DocumentUnit values.
This overload is useful when you have already createdinstances with specific units and want to reuse them for positioning.
Parameters
- x
- Horizontal position as.
- y
- Vertical position as.
SetPosition(HorizontalAlignmentValues horizontalAlignment, VerticalAlignmentValues verticalAlignment)Sets the position of the graphic using alignment-based positioning.
Alignment-based positioning places the element relative to itsandreference frames. When alignment is used, any absolute offset values are cleared (set to 0) to maintain consistency.
Parameters
- horizontalAlignment
- Horizontal alignment within the reference frame.
- verticalAlignment
- Vertical alignment within the reference frame.
SetPosition(HorizontalAlignmentValues horizontalAlignment, double y, Units units)Sets the position of the graphic using mixed positioning (horizontal alignment with vertical absolute offset).
This method is useful when you want the graphic to be aligned horizontally (e.g., centered) but positioned at a specific vertical location on the page.
Parameters
- horizontalAlignment
- Horizontal alignment within the reference frame.
- y
- Vertical offset value.
- units
- Measurement unit for the vertical offset (default: points).
SetPosition(double x, VerticalAlignmentValues verticalAlignment, Units units)Sets the position of the graphic using mixed positioning (horizontal absolute offset with vertical alignment).
This method is useful when you want the graphic to be aligned vertically (e.g., centered) but positioned at a specific horizontal location on the page.
Parameters
- x
- Horizontal offset value.
- verticalAlignment
- Vertical alignment within the reference frame.
- units
- Measurement unit for the horizontal offset (default: points).
SetRelativePosition
SetRelativePosition(HorizontalRelativePositionValues horizontalRelative, VerticalRelativePositionValues verticalRelative)Sets the relative positioning reference frames for the graphic.
The reference frames determine what the alignment or absolute position is measured against. For example, settingmeans that horizontal alignment or offsets are relative to the page margins.
Parameters
- horizontalRelative
- The horizontal reference frame (page, margin, column, etc.).
- verticalRelative
- The vertical reference frame (page, margin, paragraph, line, etc.).
SetRotation
2 overloadsSetRotation(double angle)Sets the rotation angle of the graphic.
Rotation is applied around the graphic's anchor point, which is typically the center of the bounding box. The method automatically initializesif it is. The angle is normalized to the range [0, 360) by theclass.
Parameters
- angle
- Rotation angle in degrees (positive = clockwise).
SetRotation(Rotation rotation)Sets the rotation of the graphic using a pre-configuredobject.
Parameters
- rotation
- The rotation object containing the angle.
SetScale
2 overloadsSetScale(double scaleWidth, double scaleHeight)Sets the scale percentages for the graphic dimensions.
Scaling is applied relative to the original dimensions of the graphic. A value of 100 means no scaling, 200 means double size, 50 means half size.
Parameters
- scaleWidth
- Width scale as percentage (100 = normal).
- scaleHeight
- Height scale as percentage (100 = normal).
SetScale(Percentage scaleWidth, Percentage scaleHeight)Sets the scale percentages usingobjects.
Parameters
- scaleWidth
- Width scale as.
- scaleHeight
- Height scale as.
SetWrappingStyle
SetWrappingStyle(WrappingStyle wrappingStyle)Sets the text wrapping style for the graphic.
The wrapping style determines how text flows around the graphic. The method automatically initializesandif they are.
Parameters
- wrappingStyle
- The wrapping style (Inline, Square, Through, TopAndBottom, etc.).
SetWrapPolygon
SetWrapPolygon(IList<BasePosition> wrapPolygon)Sets a custom wrap polygon for the graphic.
The wrap polygon defines a custom shape around the graphic that text will flow around. This provides fine-grained control over text wrapping behavior.
Parameters
- wrapPolygon
- A list ofpoints defining the wrap polygon.
SetWrapText
SetWrapText(WrapTextValues wrapText)Sets the wrap text value (whether text wraps on both sides, left only, right only, etc.).
Parameters
- wrapText
- The wrap text enumeration value.