# PdfPen class

> How lines and outlines are stroked. Immutable; use with to derive variants.

Namespace: [PdfNetStack.Drawing](https://www.jadev-corp.com/api/pdfnetstack-drawing/)  
Assembly: PdfNetStack.dll  
Package: `PdfNetStack`

How lines and outlines are stroked. Immutable; use <code>with</code> to derive variants.

```csharp
public sealed record PdfPen : IEquatable<PdfPen>
```

**Inheritance**

[object](https://learn.microsoft.com/dotnet/api/system.object) ← 
[PdfPen](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfpen/)

**Implements**

[IEquatable&lt;PdfPen\>](https://learn.microsoft.com/dotnet/api/system.iequatable\-1)

## Constructors

### <a id="PdfNetStack_Drawing_PdfPen__ctor_PdfNetStack_Drawing_PdfColor_System_Double_"></a> PdfPen\(PdfColor, double\)

Creates a solid pen.

```csharp
public PdfPen(PdfColor color, double width = 1)
```

#### Parameters

`color` [PdfColor](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfcolor/)

Stroke color.

`width` [double](https://learn.microsoft.com/dotnet/api/system.double)

Line width in points. 0 draws the thinnest line the device can show.

## Properties

### <a id="PdfNetStack_Drawing_PdfPen_Black"></a> Black

A 1 point black pen.

```csharp
public static PdfPen Black { get; }
```

#### Property Value

 [PdfPen](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfpen/)

### <a id="PdfNetStack_Drawing_PdfPen_Color"></a> Color

Stroke color.

```csharp
public PdfColor Color { get; init; }
```

#### Property Value

 [PdfColor](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdfcolor/)

### <a id="PdfNetStack_Drawing_PdfPen_DashOffset"></a> DashOffset

Offset into the dash pattern where the line starts.

```csharp
public double DashOffset { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

### <a id="PdfNetStack_Drawing_PdfPen_DashPattern"></a> DashPattern

Alternating dash and gap lengths in points; empty for a solid line.

```csharp
public IReadOnlyList<double> DashPattern { get; init; }
```

#### Property Value

 [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[double](https://learn.microsoft.com/dotnet/api/system.double)\>

### <a id="PdfNetStack_Drawing_PdfPen_LineCap"></a> LineCap

End shape. Default butt.

```csharp
public PdfLineCap LineCap { get; init; }
```

#### Property Value

 [PdfLineCap](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdflinecap/)

### <a id="PdfNetStack_Drawing_PdfPen_LineJoin"></a> LineJoin

Corner shape. Default miter.

```csharp
public PdfLineJoin LineJoin { get; init; }
```

#### Property Value

 [PdfLineJoin](https://www.jadev-corp.com/api/pdfnetstack-drawing/pdflinejoin/)

### <a id="PdfNetStack_Drawing_PdfPen_MiterLimit"></a> MiterLimit

Miter limit, at least 1. Default 10, as in PDF.

```csharp
public double MiterLimit { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

### <a id="PdfNetStack_Drawing_PdfPen_Width"></a> Width

Line width in points.

```csharp
public double Width { get; init; }
```

#### Property Value

 [double](https://learn.microsoft.com/dotnet/api/system.double)

## Used in

- [PDF coordinates and units in PdfNetStack](https://www.jadev-corp.com/concepts/coordinates-and-units/)
- [PDF links and annotations in C# and .NET](https://www.jadev-corp.com/guides/annotations/)
- [Draw on PDF pages in C# and .NET](https://www.jadev-corp.com/guides/drawing/)
- [Add images to PDF in C# and .NET](https://www.jadev-corp.com/guides/images/)

Source: https://www.jadev-corp.com/pdfnetstack/api/pdfnetstack-drawing/pdfpen/
