# How to Create Invisible Signatures for PDF Documents

## Environment

| Version    | Product          | Author                                                                          |
| ---------- | ---------------- | ------------------------------------------------------------------------------- |
| 2024.1.124 | RadPdfProcessing | [Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova) |

## Description

This article shows how to sign PDF documents with invisible signatures.

## Solution

Create an invisible signature by not setting the size of the signature widget. You can achieve this with signature flags.

RadPdfProcessing offers the ability to set the signature flags. The possible values are as specified in the PDF Standard:

| Value             | Description                                                                                                               |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `None`            | The document does not contain signatures.                                                                                 |
| `SignaturesExist` | If set, the document contains at least one signature field.                                                               |
| `AppendOnly`      | The document contains signatures that may be invalidated if the file is saved in a way that alters its previous contents. |

With this functionality, you can specify that a signature exists even if the signature itself does not have a visual representation. For example, create a signature without visible content (empty widget) and set the flags with the following code:

```csharp
X509Certificate2 certificate = new X509Certificate2("Certificate.pfx", "Password");
string signatureName = "SignatureName";
SignatureField signatureField = new SignatureField(signatureName)
{
    Signature = new Signature(certificate)
};
SignatureWidget widget = signatureField.Widgets.AddWidget();

PdfFormatProvider provider = new PdfFormatProvider();
RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage(); 
page.Annotations.Add(widget);
document.AcroForm.FormFields.Add(signatureField);
document.AcroForm.SignatureFlags = SignatureFlags.SignaturesExist | SignatureFlags.AppendOnly;

string signedDocumentFilePath = "Signed.pdf";
File.Delete(signedDocumentFilePath);
using (System.IO.Stream output = new System.IO.FileStream(signedDocumentFilePath, 
    System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))
{
    provider.Export(document, output);
}

```

![Invisible Signature in a PDF document](https://www.telerik.com/document-processing-libraries/documentation/assets/0a5d96c962b71741843b5be8aac99c4c/pdf-invisible-signatures.png)

## See Also

* [Signing a Document with a Digital Signature](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/signing-a-document-with-digital-signature)
* [Widgets Types](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/model/annotations/widgets)
* [Signing a PDF Document with a SignatureWidget](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/sign-pdf-with-signature-widget)
