# Add a signature field to a PDF in C#

> Add an empty signature field to a PDF in .NET so a signer can sign it in their PDF viewer, with border and tooltip. MIT licensed, pure C#.

Available since 1.1.

Place an empty signature box on a page for someone to sign later in their PDF viewer.

## Short answer

Call `doc.Form.AddSignatureField` with the page, a field name and the box position and size,
measured from the page's top left corner in points. `PdfFieldOptions` sets the border, background
and tooltip.

```csharp title="recipe-add-signature-field.cs"
#:package PdfNetStack@1.2.0
using PdfNetStack;
using PdfNetStack.Drawing;

PdfDocument doc = PdfDocument.Open("contract.pdf");
PdfPage last = doc.Pages[^1];
doc.Form.AddSignatureField(last, "signature", 72, 730, 220, 60, new PdfFieldOptions
{
    BorderColor = PdfColor.Gray(0.5),
    ToolTip = "Sign here",
});
doc.Save("contract-to-sign.pdf");
Console.WriteLine(string.Join(", ", PdfDocument.Open("contract-to-sign.pdf").Form.Fields.Select(f => $"{f.Name} ({f.Kind})")));
```

## Notes

To sign in code instead, use `PdfSigner.Sign`. It adds its own signature field, with an optional
visible appearance, in an incremental update, and does not fill an existing empty field. See
[Signatures](https://www.jadev-corp.com/guides/signatures/).

## Related

- [Forms](https://www.jadev-corp.com/guides/forms/)
- [Signatures](https://www.jadev-corp.com/guides/signatures/)
- API: [PdfAcroForm](https://www.jadev-corp.com/api/pdfnetstack/pdfacroform/), [PdfFieldOptions](https://www.jadev-corp.com/api/pdfnetstack/pdffieldoptions/)

Source: https://www.jadev-corp.com/pdfnetstack/recipes/add-signature-field/
