Class PdfPathObject
public class PdfPathObject : PdfPageObject, IDisposable
- Inheritance
-
PdfPathObject
- Implements
- Inherited Members
Methods
BezierTo(float, float, float, float, float, float)
Appends a cubic Bézier curve to the current path.
public void BezierTo(float x1, float y1, float x2, float y2, float x3, float y3)
Parameters
x1
floatX-coordinate of the first control point.
y1
floatY-coordinate of the first control point.
x2
floatX-coordinate of the second control point.
y2
floatY-coordinate of the second control point.
x3
floatX-coordinate of the end point.
y3
floatY-coordinate of the end point.
Exceptions
- dotPDFiumException
Thrown if the curve could not be added.
ClosePath()
Closes the current path in the PDF document.
public void ClosePath()
Remarks
This method finalizes the current path by connecting the last point to the first point, forming a closed shape. It is typically used when creating vector graphics or shapes in a PDF document. If the operation fails, an exception is thrown.
Exceptions
- dotPDFiumException
Thrown if the path cannot be closed due to an error in the underlying PDF library.
GetDashPattern()
Retrieves the full stroke dash pattern as an array of floats. If none is defined, returns an empty array.
public float[] GetDashPattern()
Returns
- float[]
GetDashPatternCount()
Retrieves the dash pattern used for stroking paths in the current page object.
public int GetDashPatternCount()
Returns
- int
An array of float values representing the dash pattern. Each value specifies the length of a dash or gap in the pattern. Returns an empty array if no dash pattern is defined.
Exceptions
- dotPDFiumException
Thrown if the dash pattern cannot be retrieved due to an error in the underlying PDF library.
GetDashPhase()
Retrieves the dash phase, which specifies the offset into the dash pattern at which stroking begins.
public float GetDashPhase()
Returns
- float
The dash phase as a float.
Exceptions
- dotPDFiumException
Thrown if the phase could not be retrieved.
GetDrawMode(out PdfPathDrawMode, out bool)
Retrieves the drawing mode and stroke information for the current PDF path.
public void GetDrawMode(out PdfPathDrawMode mode, out bool stroke)
Parameters
mode
PdfPathDrawModeWhen this method returns, contains the drawing mode of the PDF path, represented as a PdfPathDrawMode enumeration value.
stroke
boolWhen this method returns, contains a value indicating whether the path is stroked. true if the path is stroked; otherwise, false.
Exceptions
- dotPDFiumException
Thrown if the drawing mode cannot be retrieved due to an error in the underlying PDFium library.
GetLineCap()
Retrieves the line cap style used when stroking the path.
public PdfLineCapStyle GetLineCap()
Returns
- PdfLineCapStyle
A PdfLineCapStyle value indicating the cap type.
GetLineJoin()
Retrieves the line join style used when stroking connected segments in the path.
public PdfLineJoinStyle GetLineJoin()
Returns
- PdfLineJoinStyle
A PdfLineJoinStyle indicating how corners are rendered.
GetPoint()
Gets the (x, y) coordinates of this path segment.
public (double X, double Y) GetPoint()
Returns
GetSegmentCount()
Returns the number of segments in this path object.
public int GetSegmentCount()
Returns
GetSegmentType()
Gets the type of this path segment.
public PdfPathSegmentType GetSegmentType()
Returns
IsCloseSegment()
Returns true if this segment closes the current subpath.
public bool IsCloseSegment()
Returns
LineTo(float, float)
Adds a straight line segment from the current point to the specified coordinates.
public void LineTo(float x, float y)
Parameters
x
floatThe x-coordinate of the endpoint of the line segment.
y
floatThe y-coordinate of the endpoint of the line segment.
Exceptions
- dotPDFiumException
Thrown if the operation fails due to an error in the underlying PDF library.
MoveTo(float, float)
Moves the current path to the specified coordinates.
public void MoveTo(float x, float y)
Parameters
Exceptions
- dotPDFiumException
Thrown if the operation fails to move the path to the specified coordinates.
SetDashPattern(float[], float)
Sets the dash pattern and phase used when stroking the path.
public void SetDashPattern(float[] pattern, float phase = 0)
Parameters
pattern
float[]An array of floats representing the dash/gap lengths (e.g. [3,2] for 3pt line, 2pt gap).
phase
floatOffset into the dash pattern at which stroking begins.
Exceptions
- ArgumentException
Thrown if pattern is null or empty.
- dotPDFiumException
Thrown if the dash pattern could not be set.
SetDashPhase(float)
Sets the dash phase, which specifies the offset into the dash pattern at which stroking begins.
public void SetDashPhase(float phase)
Parameters
phase
floatThe phase offset (in points).
Exceptions
- dotPDFiumException
Thrown if the operation fails.
SetDrawMode(PdfPathDrawMode, bool)
Sets the drawing mode for the current PDF path.
public void SetDrawMode(PdfPathDrawMode mode, bool stroke)
Parameters
mode
PdfPathDrawModeThe drawing mode to apply to the path. This determines how the path is rendered, such as fill, stroke, or a combination of both.
stroke
boolA value indicating whether the path should be stroked. true to stroke the path; otherwise, false.
Exceptions
- dotPDFiumException
Thrown if the operation fails to set the draw mode.
SetLineCap(PdfLineCapStyle)
Sets the line cap style used at the ends of stroked open subpaths.
public void SetLineCap(PdfLineCapStyle capStyle)
Parameters
capStyle
PdfLineCapStyleThe desired PdfLineCapStyle.
Exceptions
- dotPDFiumException
Thrown if the operation fails.
SetLineJoin(PdfLineJoinStyle)
Sets the line join style used for path corners when stroking.
public void SetLineJoin(PdfLineJoinStyle joinStyle)
Parameters
joinStyle
PdfLineJoinStyleThe desired PdfLineJoinStyle to apply.
Exceptions
- dotPDFiumException
Thrown if the operation fails.