Table of Contents

Class PdfPath

Namespace
Syncfusion.Pdf.Graphics
Assembly
Syncfusion.Pdf.Portable.dll

Implements graphics path, which is a sequence of primitive graphics elements.

public class PdfPath : PdfFillElement
Inheritance
PdfPath
Inherited Members

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

Constructors

PdfPath()

Initializes a new instance of the PdfPath class.

public PdfPath()

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PointF[], byte[])

Initializes a new instance of the PdfPath class.

public PdfPath(PointF[] points, byte[] pathTypes)

Parameters

points PointF[]

The array of points that represents the points to define the path.

pathTypes byte[]

The path types specifies the types of the corresponding points in the path.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
// Create an array of points.
PointF[] pathPoints = { new PointF(0, 0), new PointF(100, 0), new PointF(100, 100), new PointF(0, 100), new PointF(0, 0), new PointF(100, 100), new PointF(0, 100), new PointF(100, 0) };
//Create path types.
byte[] pathTypes = { 0, 1, 1, 129, 0, 1, 1, 1 };
//Create new PDF path.
PdfPath path = new PdfPath(pathPoints, pathTypes);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
' Create an array of points.
Dim pathPoints As PointF() = {New PointF(0, 0), New PointF(100, 0), New PointF(100, 100), New PointF(0, 100), New PointF(0, 0), New PointF(100, 100), New PointF(0, 100), New PointF(100, 0)}
'Create path types.
Dim pathTypes As Byte() = {0, 1, 1, 129, 0, 1, 1, 1}
'Create new PDF path.
Dim path As New PdfPath(pathPoints, pathTypes)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfBrush)

Initializes a new instance of the PdfPath class.

public PdfPath(PdfBrush brush)

Parameters

brush PdfBrush

The brush.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath(PdfBrushes.Red);
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath(PdfBrushes.Red)
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfBrush, PdfFillMode)

Initializes a new instance of the PdfPath class.

public PdfPath(PdfBrush brush, PdfFillMode fillMode)

Parameters

brush PdfBrush

The brush.

fillMode PdfFillMode

The fill mode specifies how the interiors of shapes in this path are filled.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath(PdfBrushes.Red, PdfFillMode.Alternate);
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath(PdfBrushes.Red, PdfFillMode.Alternate)
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfBrush, PdfFillMode, PointF[], byte[])

Initializes a new instance of the PdfPath class.

public PdfPath(PdfBrush brush, PdfFillMode fillMode, PointF[] points, byte[] pathTypes)

Parameters

brush PdfBrush

The brush.

fillMode PdfFillMode

The fill mode specifies how the interiors of shapes in this path are filled.

points PointF[]

The array of points that represents the points to define the path.

pathTypes byte[]

The path types specifies the types of the corresponding points in the path.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
// Create an array of points.
PointF[] pathPoints = { new PointF(0, 0), new PointF(100, 0), new PointF(100, 100), new PointF(0, 100), new PointF(0, 0), new PointF(100, 100), new PointF(0, 100), new PointF(100, 0) };
//Create path types.
byte[] pathTypes = { 0, 1, 1, 129, 0, 1, 1, 1 };
//Create new PDF path.
PdfPath path = new PdfPath(PdfBrushes.Red, PdfFillMode.Alternate, pathPoints, pathTypes);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
' Create an array of points.
Dim pathPoints As PointF() = {New PointF(0, 0), New PointF(100, 0), New PointF(100, 100), New PointF(0, 100), New PointF(0, 0), New PointF(100, 100), New PointF(0, 100), New PointF(100, 0)}
'Create path types.
Dim pathTypes As Byte() = {0, 1, 1, 129, 0, 1, 1, 1}
'Create new PDF path.
Dim path As New PdfPath(PdfBrushes.Red, PdfFillMode.Alternate, pathPoints, pathTypes)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfPen)

Initializes a new instance of the PdfPath class.

public PdfPath(PdfPen pen)

Parameters

pen PdfPen

The pen.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath(PdfPens.Red);
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath(PdfPens.Red)
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfPen, PointF[], byte[])

Initializes a new instance of the PdfPath class.

public PdfPath(PdfPen pen, PointF[] points, byte[] pathTypes)

Parameters

pen PdfPen

The pen.

points PointF[]

The array of points that represents the points to define the path.

pathTypes byte[]

The path types specifies the types of the corresponding points in the path.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
// Create an array of points.
PointF[] pathPoints = { new PointF(0, 0), new PointF(100, 0), new PointF(100, 100), new PointF(0, 100), new PointF(0, 0), new PointF(100, 100), new PointF(0, 100), new PointF(100, 0) };
//Create path types.
byte[] pathTypes = { 0, 1, 1, 129, 0, 1, 1, 1 };
//Create new PDF path.
PdfPath path = new PdfPath(PdfPens.Red, pathPoints, pathTypes);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
' Create an array of points.
Dim pathPoints As PointF() = {New PointF(0, 0), New PointF(100, 0), New PointF(100, 100), New PointF(0, 100), New PointF(0, 0), New PointF(100, 100), New PointF(0, 100), New PointF(100, 0)}
'Create path types.
Dim pathTypes As Byte() = {0, 1, 1, 129, 0, 1, 1, 1}
'Create new PDF path.
Dim path As New PdfPath(PdfPens.Red, pathPoints, pathTypes)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PdfPath(PdfPen, PdfBrush, PdfFillMode)

Initializes a new instance of the PdfPath class.

public PdfPath(PdfPen pen, PdfBrush brush, PdfFillMode fillMode)

Parameters

pen PdfPen

The pen.

brush PdfBrush

The brush.

fillMode PdfFillMode

The fill mode specifies how the interiors of shapes in this path are filled.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath(PdfPens.Green, PdfBrushes.Red, PdfFillMode.Alternate);
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath(PdfPens.Green, PdfBrushes.Red, PdfFillMode.Alternate)
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

Properties

FillMode

Gets or sets the fill mode.

public PdfFillMode FillMode { get; set; }

Property Value

PdfFillMode

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

LastPoint

Gets the last point.

public PointF LastPoint { get; }

Property Value

PointF

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Get last point.
PointF lastPoint = path.LastPoint;
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Get last point.
Dim lastPoint As PointF = path.LastPoint
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PathPoints

Gets the path points.

public PointF[] PathPoints { get; }

Property Value

PointF[]

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Get path Points.
PointF[] pathPoints = path.PathPoints;
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Get path Points.
Dim pathPoints As PointF() = path.PathPoints
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PathTypes

Gets the path point types.

public byte[] PathTypes { get; }

Property Value

byte[]

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Get path Types.
byte[] pathTypes = path.PathTypes;
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Set the path fill mode.
path.FillMode = PdfFillMode.Winding;
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Get path Types.
Dim pathTypes As Byte() = path.PathTypes
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

PointCount

Gets the point count.

public int PointCount { get; }

Property Value

int

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();        
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Get path point count.
int count = path.PointCount;
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()       
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Get path point count.
Dim count As Integer = path.PointCount
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

Methods

AddArc(RectangleF, float, float)

Adds an arc.

public void AddArc(RectangleF rectangle, float startAngle, float sweepAngle)

Parameters

rectangle RectangleF

The boundaries of the arc.

startAngle float

The start angle of the arc.

sweepAngle float

The angle between startAngle and the end of the arc.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
 //Add arc.
 path.AddArc(new RectangleF(0, 0, 100, 100), 0, -90);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add arc.
path.AddArc(New RectangleF(0, 0, 100, 100), 0, -90)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddArc(float, float, float, float, float, float)

Adds an arc.

public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangular region.

y float

The y-coordinate of the upper-left corner of the rectangular region.

width float

The width of the rectangular region.

height float

The height of the rectangular region.

startAngle float

The start angle of the arc.

sweepAngle float

The angle between startAngle and the end of the arc.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
 //Add arc.
 path.AddArc(0, 0, 100, 100, 0, -90);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add arc.
path.AddArc(0, 0, 100, 100, 0, -90)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddBezier(PointF, PointF, PointF, PointF)

Adds a bezier curve.

public void AddBezier(PointF startPoint, PointF firstControlPoint, PointF secondControlPoint, PointF endPoint)

Parameters

startPoint PointF

The start point - represents the starting point of the curve.

firstControlPoint PointF

The first control point - represents the first control point of the curve.

secondControlPoint PointF

The second control point - repesents the second control point of the curve.

endPoint PointF

The end point - represents the end point of the curve.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Start figure.
path.StartFigure();
//Add bezier.
path.AddBezier(new PointF(30, 30), new PointF(90, 0), new PointF(60, 90), new PointF(120, 30));
//Close figure.
path.CloseFigure();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Start figure.
path.StartFigure()
'Add bezier.
path.AddBezier(New PointF(30, 30), New PointF(90, 0), New PointF(60, 90), New PointF(120, 30))
'Close figure.
path.CloseFigure()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddBezier(float, float, float, float, float, float, float, float)

Adds a bezier curve.

public void AddBezier(float startPointX, float startPointY, float firstControlPointX, float firstControlPointY, float secondControlPointX, float secondControlPointY, float endPointX, float endPointY)

Parameters

startPointX float

The start point X.

startPointY float

The start point Y.

firstControlPointX float

The first control point X.

firstControlPointY float

The first control point Y.

secondControlPointX float

The second control point X.

secondControlPointY float

The second control point Y.

endPointX float

The end point X.

endPointY float

The end point Y.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Start figure.
path.StartFigure();
//Add bezier.
path.AddBezier(30, 30, 90, 0, 60, 90, 120, 30);
//Close figure.
path.CloseFigure();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Start figure.
path.StartFigure()
'Add bezier.
path.AddBezier(30, 30, 90, 0, 60, 90, 120, 30)
'Close figure.
path.CloseFigure()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddEllipse(RectangleF)

Adds an ellipse.

public void AddEllipse(RectangleF rectangle)

Parameters

rectangle RectangleF

The boundaries of the ellipse.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
 //Add ellipse.
 path.AddEllipse(new RectangleF(0, 0, 200, 100));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add ellipse.
path.AddEllipse(New RectangleF(0, 0, 200, 100))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddEllipse(float, float, float, float)

Adds an ellipse.

public void AddEllipse(float x, float y, float width, float height)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangular region.

y float

The y-coordinate of the upper-left corner of the rectangular region.

width float

The width of the rectangular region.

height float

The height of the rectangular region.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
 //Add ellipse.
 path.AddEllipse(0, 0, 200, 100);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add ellipse.
path.AddEllipse(0, 0, 200, 100)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddLine(PointF, PointF)

Adds a line.

public void AddLine(PointF point1, PointF point2)

Parameters

point1 PointF

The start point of the line.

point2 PointF

The end point of the line.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add line path points.
path.AddLine(new PointF(10, 100), new PointF(10, 200));
path.AddLine(new PointF(100, 100), new PointF(100, 200));
path.AddLine(new PointF(100, 200), new PointF(55, 150));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add line path points.
path.AddLine(New PointF(10, 100), New PointF(10, 200))
path.AddLine(New PointF(100, 100), New PointF(100, 200))
path.AddLine(New PointF(100, 200), New PointF(55, 150))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddLine(float, float, float, float)

Adds a line.

public void AddLine(float x1, float y1, float x2, float y2)

Parameters

x1 float

The x-coordinate of the starting point of the line.

y1 float

The y-coordinate of the starting point of the line.

x2 float

The x-coordinate of the end point of the line.

y2 float

The y-coordinate of the end point of the line.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add line path points.
path.AddLine(10, 100, 10, 200);        
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add line path points.
path.AddLine(10, 100, 10, 200)        
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddPath(PointF[], byte[])

Appends the path specified by the points and their types to this one.

public void AddPath(PointF[] pathPoints, byte[] pathTypes)

Parameters

pathPoints PointF[]
pathTypes byte[]

The path types specifies the types of the corresponding points in the path.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
// Create an array of points.
PointF[] pathPoints = { new PointF(0, 0), new PointF(100, 0), new PointF(100, 100), new PointF(0, 100), new PointF(0, 0), new PointF(100, 100), new PointF(0, 100), new PointF(100, 0) };
//Create path types.
byte[] pathTypes = { 0, 1, 1, 129, 0, 1, 1, 1 };       
//Add path.
path.AddPath(pathPoints, pathTypes);      
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
' Create an array of points.
Dim pathPoints As PointF() = {New PointF(0, 0), New PointF(100, 0), New PointF(100, 100), New PointF(0, 100), New PointF(0, 0), New PointF(100, 100), New PointF(0, 100), New PointF(100, 0)}
'Create path types.
Dim pathTypes As Byte() = {0, 1, 1, 129, 0, 1, 1, 1}       
'Add path.
path.AddPath(pathPoints, pathTypes)    
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddPath(PdfPath)

Appends the path specified to this one.

public void AddPath(PdfPath path)

Parameters

path PdfPath

The path, which should be appended.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
// Create an array of points.
PointF[] pathPoints = { new PointF(0, 0), new PointF(100, 0), new PointF(100, 100), new PointF(0, 100), new PointF(0, 0), new PointF(100, 100), new PointF(0, 100), new PointF(100, 0) };
//Create path types.
byte[] pathTypes = { 0, 1, 1, 129, 0, 1, 1, 1 };
//Create PDF path.
PdfPath pPath = new PdfPath(pathPoints, pathTypes);
//Add PDF path.
path.AddPath(pPath);      
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
' Create an array of points.
Dim pathPoints As PointF() = {New PointF(0, 0), New PointF(100, 0), New PointF(100, 100), New PointF(0, 100), New PointF(0, 0), New PointF(100, 100), New PointF(0, 100), New PointF(100, 0)}
'Create path types.
Dim pathTypes As Byte() = {0, 1, 1, 129, 0, 1, 1, 1}
'Create PDF path.
Dim pPath As New PdfPath(pathPoints, pathTypes)
'Add PDF path.
path.AddPath(pPath)    
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddPie(RectangleF, float, float)

Appends the pie to this path.

public void AddPie(RectangleF rectangle, float startAngle, float sweepAngle)

Parameters

rectangle RectangleF

The bounding rectangle of the pie.

startAngle float

The start angle of the pie.

sweepAngle float

The sweep angle of the pie.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add Pie.
path.AddPie(new RectangleF(20, 20, 70, 70), -45, 90);   
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add Pie.
path.AddPie(New RectangleF(20, 20, 70, 70), -45, 90)  
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddPie(float, float, float, float, float, float)

Appends the pie to this path.

public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle)

Parameters

x float

The x-coordinate of the upper-left corner of the bounding rectangle.

y float

The y-coordinate of the upper-left corner of the bounding rectangle.

width float

The width of the bounding rectangle.

height float

The height of the bounding rectangle.

startAngle float

The start angle of the pie.

sweepAngle float

The sweep angle of the pie.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add Pie.
path.AddPie(20, 20, 70, 70, -45, 90);   
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add Pie.
path.AddPie(20, 20, 70, 70, -45, 90)  
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddPolygon(PointF[])

Append the closed polygon to this path.

public void AddPolygon(PointF[] points)

Parameters

points PointF[]

The points of the polygon.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Create polygon points.
PointF[] polygonPoints = { new PointF(23, 20), new PointF(40, 10), new PointF(57, 20), new PointF(50, 40), new PointF(30, 40) };
//Add polygon.
path.AddPolygon(polygonPoints);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Create polygon points.
Dim polygonPoints As PointF() = {New PointF(23, 20), New PointF(40, 10), New PointF(57, 20), New PointF(50, 40), New PointF(30, 40)}
'Add polygon.
path.AddPolygon(polygonPoints)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddRectangle(RectangleF)

Appends the rectangle to this path.

public void AddRectangle(RectangleF rectangle)

Parameters

rectangle RectangleF

The rectangle.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add rectangle
path.AddRectangle(new RectangleF(0, 0, 200, 100));
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add rectangle
path.AddRectangle(New RectangleF(0, 0, 200, 100))
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

AddRectangle(float, float, float, float)

Appends the rectangle to this path.

public void AddRectangle(float x, float y, float width, float height)

Parameters

x float

The x-coordinate of the upper-left corner of the rectangular region.

y float

The y-coordinate of the upper-left corner of the rectangular region.

width float

The width of the rectangular region.

height float

The height of the rectangular region.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add rectangle
path.AddRectangle(0, 0, 200, 100);
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add rectangle
path.AddRectangle(0, 0, 200, 100)
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

CloseAllFigures()

Closes all non-closed figures.

public void CloseAllFigures()

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
path.StartFigure();
path.AddLine(new Point(10, 100), new Point(150, 100));
path.AddLine(new Point(150, 100), new Point(10, 200));
path.StartFigure();
path.AddArc(200, 200, 100, 100, 0, 90);
path.StartFigure();
PointF point1 = new PointF(300, 300);
PointF point2 = new PointF(400, 325);
PointF point3 = new PointF(400, 375);
PointF point4 = new PointF(300, 400);
PointF[] points = { point1, point2, point3, point4 };
path.AddPolygon(points);
//Close all the figures.
path.CloseAllFigures();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
path.StartFigure()
path.AddLine(New Point(10, 100), New Point(150, 100))
path.AddLine(New Point(150, 100), New Point(10, 200))
path.StartFigure()
path.AddArc(200, 200, 100, 100, 0, 90)
path.StartFigure()
Dim point1 As New PointF(300, 300)
Dim point2 As New PointF(400, 325)
Dim point3 As New PointF(400, 375)
Dim point4 As New PointF(300, 400)
Dim points As PointF() = {point1, point2, point3, point4}
path.AddPolygon(points)
'Close all the figures.
path.CloseAllFigures()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

CloseFigure()

Closes the last figure.

public void CloseFigure()

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Start first figure.
path.StartFigure();
path.AddArc(10, 10, 50, 50, 0, 270);                  
path.CloseFigure();          
//Start second figure.
path.StartFigure();
path.AddRectangle(10, 70, 50, 100);            
path.CloseFigure();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Start first figure.
path.StartFigure()
path.AddArc(10, 10, 50, 50, 0, 270)
path.CloseFigure()
'Start second figure.
path.StartFigure()
path.AddRectangle(10, 70, 50, 100)
path.CloseFigure()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

DrawInternal(PdfGraphics)

Draws an element on the Graphics.

protected override void DrawInternal(PdfGraphics graphics)

Parameters

graphics PdfGraphics

Graphics context where the element should be printed.

GetBoundsInternal()

Overloaded. Returns a rectangle that bounds this element.

protected override RectangleF GetBoundsInternal()

Returns

RectangleF

Returns a rectangle that bounds this element.

GetLastPoint()

Gets the last point.

public PointF GetLastPoint()

Returns

PointF

The last point.

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Add rectangle
path.AddRectangle(new RectangleF(0, 0, 200, 100));
 //Get last point.
 PointF lastPoint = path.GetLastPoint();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Add rectangle
path.AddRectangle(New RectangleF(0, 0, 200, 100))
'Get last point.
Dim lastPoint As PointF = path.GetLastPoint()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

StartFigure()

Starts a new figure.

public void StartFigure()

Examples

//Create a document.
PdfDocument doc = new PdfDocument();
//Add a new page.
PdfPage page = doc.Pages.Add();
//Create new PDF path.
PdfPath path = new PdfPath();
//Start first figure.
path.StartFigure();
path.AddArc(10, 10, 50, 50, 0, 270);                  
path.CloseFigure();          
//Start second figure.
path.StartFigure();
path.AddRectangle(10, 70, 50, 100);            
path.CloseFigure();
//Draw PDF path to page.
path.Draw(page, PointF.Empty);
//Save and close the document.
doc.Save("output.pdf");
doc.Close(true);
'Create a document.
Dim doc As New PdfDocument()
'Add a new page.
Dim page As PdfPage = doc.Pages.Add()
'Create new PDF path.
Dim path As New PdfPath()
'Start first figure.
path.StartFigure()
path.AddArc(10, 10, 50, 50, 0, 270)
path.CloseFigure()
'Start second figure.
path.StartFigure()
path.AddRectangle(10, 70, 50, 100)
path.CloseFigure()
'Draw PDF path to page.
path.Draw(page, PointF.Empty)
'Save and close the document.
doc.Save("output.pdf")
doc.Close(True)

Remarks

The next added primitive will start a new figure.