Class PdfPath
Implements graphics path, which is a sequence of primitive graphics elements.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfPath : PdfFillElement
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.
Declaration
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.
Declaration
public PdfPath(PointF[] points, byte[] pathTypes)
Parameters
Type | Name | Description |
---|---|---|
PointF[] | points | The array of points that represents the points to define the path. |
System.Byte[] | pathTypes | 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.
Declaration
public PdfPath(PdfBrush brush)
Parameters
Type | Name | Description |
---|---|---|
PdfBrush | brush | 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.
Declaration
public PdfPath(PdfBrush brush, PdfFillMode fillMode)
Parameters
Type | Name | Description |
---|---|---|
PdfBrush | brush | The brush. |
PdfFillMode | fillMode | 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.
Declaration
public PdfPath(PdfBrush brush, PdfFillMode fillMode, PointF[] points, byte[] pathTypes)
Parameters
Type | Name | Description |
---|---|---|
PdfBrush | brush | The brush. |
PdfFillMode | fillMode | The fill mode specifies how the interiors of shapes in this path are filled. |
PointF[] | points | The array of points that represents the points to define the path. |
System.Byte[] | pathTypes | 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.
Declaration
public PdfPath(PdfPen pen)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | 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.
Declaration
public PdfPath(PdfPen pen, PointF[] points, byte[] pathTypes)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | The pen. |
PointF[] | points | The array of points that represents the points to define the path. |
System.Byte[] | pathTypes | 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.
Declaration
public PdfPath(PdfPen pen, PdfBrush brush, PdfFillMode fillMode)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | The pen. |
PdfBrush | brush | The brush. |
PdfFillMode | fillMode | 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.
Declaration
public PdfFillMode FillMode { get; set; }
Property Value
Type |
---|
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.
Declaration
public PointF LastPoint { get; }
Property Value
Type |
---|
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.
Declaration
public PointF[] PathPoints { get; }
Property Value
Type |
---|
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.
Declaration
public byte[] PathTypes { get; }
Property Value
Type |
---|
System.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.
Declaration
public int PointCount { get; }
Property Value
Type |
---|
System.Int32 |
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, Single, Single)
Adds an arc.
Declaration
public void AddArc(RectangleF rectangle, float startAngle, float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | The boundaries of the arc. |
System.Single | startAngle | The start angle of the arc. |
System.Single | sweepAngle | 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(Single, Single, Single, Single, Single, Single)
Adds an arc.
Declaration
public void AddArc(float x, float y, float width, float height, float startAngle, float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x-coordinate of the upper-left corner of the rectangular region. |
System.Single | y | The y-coordinate of the upper-left corner of the rectangular region. |
System.Single | width | The width of the rectangular region. |
System.Single | height | The height of the rectangular region. |
System.Single | startAngle | The start angle of the arc. |
System.Single | sweepAngle | 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.
Declaration
public void AddBezier(PointF startPoint, PointF firstControlPoint, PointF secondControlPoint, PointF endPoint)
Parameters
Type | Name | Description |
---|---|---|
PointF | startPoint | The start point - represents the starting point of the curve. |
PointF | firstControlPoint | The first control point - represents the first control point of the curve. |
PointF | secondControlPoint | The second control point - repesents the second control point of the curve. |
PointF | endPoint | 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(Single, Single, Single, Single, Single, Single, Single, Single)
Adds a bezier curve.
Declaration
public void AddBezier(float startPointX, float startPointY, float firstControlPointX, float firstControlPointY, float secondControlPointX, float secondControlPointY, float endPointX, float endPointY)
Parameters
Type | Name | Description |
---|---|---|
System.Single | startPointX | The start point X. |
System.Single | startPointY | The start point Y. |
System.Single | firstControlPointX | The first control point X. |
System.Single | firstControlPointY | The first control point Y. |
System.Single | secondControlPointX | The second control point X. |
System.Single | secondControlPointY | The second control point Y. |
System.Single | endPointX | The end point X. |
System.Single | endPointY | 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.
Declaration
public void AddEllipse(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | 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(Single, Single, Single, Single)
Adds an ellipse.
Declaration
public void AddEllipse(float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x-coordinate of the upper-left corner of the rectangular region. |
System.Single | y | The y-coordinate of the upper-left corner of the rectangular region. |
System.Single | width | The width of the rectangular region. |
System.Single | height | 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.
Declaration
public void AddLine(PointF point1, PointF point2)
Parameters
Type | Name | Description |
---|---|---|
PointF | point1 | The start point of the line. |
PointF | point2 | 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(Single, Single, Single, Single)
Adds a line.
Declaration
public void AddLine(float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x1 | The x-coordinate of the starting point of the line. |
System.Single | y1 | The y-coordinate of the starting point of the line. |
System.Single | x2 | The x-coordinate of the end point of the line. |
System.Single | y2 | 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.
Declaration
public void AddPath(PointF[] pathPoints, byte[] pathTypes)
Parameters
Type | Name | Description |
---|---|---|
PointF[] | pathPoints | |
System.Byte[] | pathTypes | 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.
Declaration
public void AddPath(PdfPath path)
Parameters
Type | Name | Description |
---|---|---|
PdfPath | path | 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, Single, Single)
Appends the pie to this path.
Declaration
public void AddPie(RectangleF rectangle, float startAngle, float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | The bounding rectangle of the pie. |
System.Single | startAngle | The start angle of the pie. |
System.Single | sweepAngle | 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(Single, Single, Single, Single, Single, Single)
Appends the pie to this path.
Declaration
public void AddPie(float x, float y, float width, float height, float startAngle, float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x-coordinate of the upper-left corner of the bounding rectangle. |
System.Single | y | The y-coordinate of the upper-left corner of the bounding rectangle. |
System.Single | width | The width of the bounding rectangle. |
System.Single | height | The height of the bounding rectangle. |
System.Single | startAngle | The start angle of the pie. |
System.Single | sweepAngle | 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.
Declaration
public void AddPolygon(PointF[] points)
Parameters
Type | Name | Description |
---|---|---|
PointF[] | points | 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.
Declaration
public void AddRectangle(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle | 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(Single, Single, Single, Single)
Appends the rectangle to this path.
Declaration
public void AddRectangle(float x, float y, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x | The x-coordinate of the upper-left corner of the rectangular region. |
System.Single | y | The y-coordinate of the upper-left corner of the rectangular region. |
System.Single | width | The width of the rectangular region. |
System.Single | height | 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.
Declaration
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.
Declaration
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)
GetLastPoint()
Gets the last point.
Declaration
public PointF GetLastPoint()
Returns
Type | Description |
---|---|
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.
Declaration
public void StartFigure()
Remarks
The next added primitive will start a new figure.
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)