Table of Contents

Class PdfPen

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

A class defining settings for drawing operations, that determines the color, width, and style of the drawing elements.

public class PdfPen : ICloneable
Inheritance
PdfPen
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Constructors

PdfPen(Color)

Initializes a new instance of the PdfPen class.

public PdfPen(Color color)

Parameters

color Color

The system color.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(Color, float)

Initializes a new instance of the PdfPen class with color and width of the pen

public PdfPen(Color color, float width)

Parameters

color Color

The Color provides color to the pen.

width float

Width of the pen's line.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red, 2);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red, 2)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(PdfExtendedColor)

Initializes a new instance of the PdfPen class with color.

public PdfPen(PdfExtendedColor color)

Parameters

color PdfExtendedColor

The PdfColor provides color to the pen.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
// Create Gray ColorSpace
PdfCalGrayColorSpace calGrayCS = new PdfCalGrayColorSpace();
// Create new instance for PdfCalGrayColor
PdfCalGrayColor gray = new PdfCalGrayColor(calGrayCS);
gray.Gray = 0.2;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(gray);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
' Create Gray ColorSpace
Dim calGrayCS As New PdfCalGrayColorSpace()
' Create new instance for PdfCalGrayColor
Dim gray As New PdfCalGrayColor(calGrayCS)
gray.Gray = 0.2
'Create new PDF pen instance.
Dim pen As New PdfPen(gray)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(PdfBrush)

Initializes a new instance of the PdfPen class with PdfBrush

public PdfPen(PdfBrush brush)

Parameters

brush PdfBrush

The PdfBrush provides color and texture to the pen.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(new PdfSolidBrush(Color.Red));
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(New PdfSolidBrush(Color.Red))
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(PdfBrush, float)

Initializes a new instance of the PdfPen class with PdfBrush and width.

public PdfPen(PdfBrush brush, float width)

Parameters

brush PdfBrush

The PdfBrush provides color and texture to the pen.

width float

Width of the pen's line.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(new PdfSolidBrush(Color.Red), 2);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(New PdfSolidBrush(Color.Red), 2)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(PdfColor)

Initializes a new instance of the PdfPen class.

public PdfPen(PdfColor color)

Parameters

color PdfColor

The color.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(new PdfColor(Color.Red));
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(New PdfColor(Color.Red))
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfPen(PdfColor, float)

Initializes a new instance of the PdfPen class with color and width of the pen

public PdfPen(PdfColor color, float width)

Parameters

color PdfColor

The PdfColor provides color to the pen.

width float

Width of the pen's line.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(new PdfColor(Color.Red), 2);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(New PdfColor(Color.Red), 2)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Properties

Brush

Gets or sets the brush, which specifies the pen behavior.

public PdfBrush Brush { get; set; }

Property Value

PdfBrush

The PdfBrush that determines the color and texture

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
 //Set brush.
 pen.Brush = new PdfSolidBrush(Color.Green);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set brush.
pen.Brush = New PdfSolidBrush(Color.Green)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Remarks

If the brush is set, the color values are ignored, except for PdfSolidBrush.

Color

Gets or sets the color of the pen.

public PdfColor Color { get; set; }

Property Value

PdfColor

The PdfColor provide the color to pen

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set pen color.
pen.Color = new PdfColor(Color.Green);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set pen color.
pen.Color = New PdfColor(Color.Green)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

DashOffset

Gets or sets the dash offset of the pen.

public float DashOffset { get; set; }

Property Value

float

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set pen dash offset.
pen.DashOffset = 0.5f;
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set pen dash offset.
pen.DashOffset = 0.5F
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

DashPattern

Gets or sets the dash pattern of the pen.

public float[] DashPattern { get; set; }

Property Value

float[]

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom;
// Create a custom dash pattern.
pen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f }
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
 'Set custom dash style.
 pen.DashStyle = PdfDashStyle.Custom
 'Create a custom dash pattern.
 pen.DashPattern = New Single() { 4.0F, 2.0F, 1.0F, 3.0F}
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Remarks

we can't set the Dash pattern for solid dash style

DashStyle

Gets or sets the dash style of the pen.

public PdfDashStyle DashStyle { get; set; }

Property Value

PdfDashStyle

The PdfDashStyle provides the various dash styles

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom;
// Create a custom dash pattern.
pen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f }
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
 'Set custom dash style.
 pen.DashStyle = PdfDashStyle.Custom
 'Create a custom dash pattern.
 pen.DashPattern = New Single() { 4.0F, 2.0F, 1.0F, 3.0F}
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

LineCap

Gets or sets the line cap of the pen.

public PdfLineCap LineCap { get; set; }

Property Value

PdfLineCap

The PdfLineCap gives various line cap options

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom;
//Set line cap.
pen.LineCap = PdfLineCap.Round;
// Create a custom dash pattern.
pen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f }
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom
'Create a custom dash pattern.
'Set line cap.
pen.LineCap = PdfLineCap.Round
 pen.DashPattern = New Single() { 4.0F, 2.0F, 1.0F, 3.0F}
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

LineJoin

Gets or sets the line join style of the pen.

public PdfLineJoin LineJoin { get; set; }

Property Value

PdfLineJoin

The PdfLineJoin provides various line join options.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom;
//Set line jion.
pen.LineJoin = PdfLineJoin.Bevel;
// Create a custom dash pattern.
pen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f }
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set custom dash style.
pen.DashStyle = PdfDashStyle.Custom
'Set line jion.
pen.LineJoin = PdfLineJoin.Bevel
'Create a custom dash pattern.
pen.DashPattern = New Single() { 4.0F, 2.0F, 1.0F, 3.0F}
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

MiterLimit

Gets or sets the miter limit.

public float MiterLimit { get; set; }

Property Value

float

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set pen width.
pen.Width = 4;
//Set miter limit,
pen.MiterLimit = 2;
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set pen width.
pen.Width = 4
'Set miter limit,
pen.MiterLimit = 2
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Width

Gets or sets the width of the pen.

public float Width { get; set; }

Property Value

float

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Set pen width.
pen.Width = 4;
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Set pen width.
pen.Width = 4
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Methods

Clone()

Clones this instance.

public PdfPen Clone()

Returns

PdfPen

A new pen with the same properties.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF pen instance.
PdfPen pen = new PdfPen(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
//Clone the PDF pen.
PdfPen pen1 = pen.Clone();
pen1.Width = 10;
graphics.DrawRectangle(pen1, new RectangleF(10, 120, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF pen instance.
Dim pen As New PdfPen(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
'Clone the PDF pen.
Dim pen1 As PdfPen = pen.Clone()
pen1.Width = 10
graphics.DrawRectangle(pen1, New RectangleF(10, 120, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)