---
title: "PdfMarker"
description: "Namespace: Lacuna.Pki.Pdf"
canonical: "https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker"
locale: "pt-BR"
product: "PKI SDK"
last_updated: "2026-06-02"
---

# PdfMarker

**Namespace:** `Lacuna.Pki.Pdf`  
**Assembly:** `Lacuna.Pki`  
_Class_

```csharp
public class PdfMarker
```

**Hierarquia:** [`object`](https://learn.microsoft.com/dotnet/api/system.object) → `PdfMarker`

## Construtores

### `PdfMarker()`

```csharp
public PdfMarker()
```

---

## Propriedades

### `NewPagesTemplate`

A page size and orientation template for creating new pages on the PDF.
If not set, the current PDF pages most common paper size portrait will be used as template.

```csharp
public PdfPageTemplate NewPagesTemplate { get; set; }
```

**Retorno**

[`PdfPageTemplate`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfPageTemplate)

---

### `PreserveSignaturesVisualRepresentation`

Whether or not to preserve images of signatures visual representations on the PDF, when present.

```csharp
public bool PreserveSignaturesVisualRepresentation { get; set; }
```

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean)

---

### `ThrowIfSignedPdf`

Throws SignedPdfToMarkException if the PDF has any signature. Default is true.

```csharp
public bool ThrowIfSignedPdf { get; set; }
```

**Retorno**

[`bool`](https://learn.microsoft.com/dotnet/api/system.boolean)

---

## Métodos

### `AddMark(PdfMark)`

```csharp
public void AddMark(PdfMark mark)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `mark` | [`PdfMark`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMark) |  |

---

### `AddMarkRange(IEnumerable<PdfMark>)`

```csharp
public void AddMarkRange(IEnumerable<PdfMark> marks)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `marks` | [`IEnumerable<PdfMark>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) |  |

---

### `AddMetadata(string, string)`

```csharp
public void AddMetadata(string key, string value)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `key` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |
| `value` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |

---

### `ComputeRequiredArea(Context, PdfMark, IEnumerable<PdfTextSection>, PadesVisualRectangle, PdfMarkRotation, double?)`

Computes the required area which can fit the text in

```csharp
public TextRequiredArea ComputeRequiredArea(PdfMarker.Context context, PdfMark mark, IEnumerable<PdfTextSection> textSections, PadesVisualRectangle textRelativeMaxWidth = null, PdfMarkRotation textRotation = PdfMarkRotation.D0, double? lineSpacing = null)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `context` | [`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context) | A current PDF to mark context from method CreateContext |
| `mark` | [`PdfMark`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMark) | The text PDF mark parent |
| `textSections` | [`IEnumerable<PdfTextSection>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) | The text in sections |
| `textRelativeMaxWidth` | [`PadesVisualRectangle`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pades/PadesVisualRectangle) | The text relative max width dimensions. Only needed any two of (Left, Right, Width) parameters |
| `textRotation` | [`PdfMarkRotation`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarkRotation) | The text rotation inside the container, if any |
| `lineSpacing` | [`double?`](https://learn.microsoft.com/dotnet/api/system.double) | The line spacing multiplier based on the font size |

**Retorno**

[`TextRequiredArea`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/TextRequiredArea)

---

### `ComputeRequiredArea(Context, PdfMark, IEnumerable<PdfTextSection>, PadesVisualRectangle, PdfMarkRotation)`

Computes the required area which can fit the text in

```csharp
public TextRequiredArea ComputeRequiredArea(PdfMarker.Context context, PdfMark mark, IEnumerable<PdfTextSection> textSections, PadesVisualRectangle textRelativeMaxWidth = null, PdfMarkRotation textRotation = PdfMarkRotation.D0)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `context` | [`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context) | A current PDF to mark context from method CreateContext |
| `mark` | [`PdfMark`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMark) | The text PDF mark parent |
| `textSections` | [`IEnumerable<PdfTextSection>`](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) | The text in sections |
| `textRelativeMaxWidth` | [`PadesVisualRectangle`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pades/PadesVisualRectangle) | The text relative max width dimensions. Only needed any two of (Left, Right, Width) parameters |
| `textRotation` | [`PdfMarkRotation`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarkRotation) | The text rotation inside the container, if any |

**Retorno**

[`TextRequiredArea`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/TextRequiredArea)

---

### `ComputeRequiredArea(Context, PdfMark, PdfMarkText)`

Computes the required area which can fit the text in

```csharp
public TextRequiredArea ComputeRequiredArea(PdfMarker.Context context, PdfMark mark, PdfMarkText markText)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `context` | [`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context) | A current PDF to mark context from method CreateContext |
| `mark` | [`PdfMark`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMark) | The text PDF mark parent |
| `markText` | [`PdfMarkText`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarkText) | The text parameters |

**Retorno**

[`TextRequiredArea`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/TextRequiredArea)

---

### `CreateContext(byte[])`

Creates a previous context with the PDF which will be marked

```csharp
public PdfMarker.Context CreateContext(byte[] pdf)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `pdf` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The PDF to be marked |

**Retorno**

[`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context)

---

### `CreateContext(Stream)`

Creates a previous context with the PDF which will be marked

```csharp
public PdfMarker.Context CreateContext(Stream pdf)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `pdf` | [`Stream`](https://learn.microsoft.com/dotnet/api/system.io.stream) | The PDF to be marked |

**Retorno**

[`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context)

---

### `SetFormField(string, string)`

```csharp
public void SetFormField(string name, string value)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `name` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |
| `value` | [`string`](https://learn.microsoft.com/dotnet/api/system.string) |  |

---

### `SetPageContentScale(PdfPageContentScale)`

```csharp
public void SetPageContentScale(PdfPageContentScale scaleParameters)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `scaleParameters` | [`PdfPageContentScale`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfPageContentScale) |  |

---

### `WriteMarks(byte[])`

Writes marks to a PDF

```csharp
public byte[] WriteMarks(byte[] pdf)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `pdf` | [`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) | The PDF file content to be marked |

**Retorno**

[`byte[]`](https://learn.microsoft.com/dotnet/api/system.byte) — PDF content withs marks

---

### `WriteMarks(Context, Stream)`

Writes marks to a PDF

```csharp
public void WriteMarks(PdfMarker.Context context, Stream output)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `context` | [`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context) | A previously created Context through method CreateContext and the PDF to be marked |
| `output` | [`Stream`](https://learn.microsoft.com/dotnet/api/system.io.stream) | PDF with marks |

---

### `WriteMarks(Context)`

Writes marks to a PDF

```csharp
public byte[] WriteMarks(PdfMarker.Context context)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `context` | [`PdfMarker.Context`](https://docs.lacunasoftware.com/api/Lacuna.Pki.Pdf/PdfMarker.Context) | A previously created Context through method CreateContext and the PDF to be marked |

**Retorno**

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

---

### `WriteMarks(Stream, Stream)`

Writes marks to a PDF

```csharp
public void WriteMarks(Stream pdf, Stream output)
```

**Parâmetros**

| Nome | Tipo | Descrição |
|---|---|---|
| `pdf` | [`Stream`](https://learn.microsoft.com/dotnet/api/system.io.stream) | The PDF to be marked |
| `output` | [`Stream`](https://learn.microsoft.com/dotnet/api/system.io.stream) | PDF with marks |

---

## Membros herdados

[`ToString()`](https://learn.microsoft.com/dotnet/api/system.object.tostring), [`Equals(object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)>), [`Equals(object, object)`](<https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)>), [`ReferenceEquals(object, object)`](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [`GetHashCode()`](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [`GetType()`](https://learn.microsoft.com/dotnet/api/system.object.gettype), [`MemberwiseClone()`](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)
