Skip to content

Commit 16d352d

Browse files
author
KB Bot
committed
Added new kb article create-pdf-with-empty-signature-field-radpdfprocessing
1 parent 16b983b commit 16d352d

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Creating a PDF Document with an Empty Signature Field Using RadPdfProcessing
3+
description: Learn how to create a PDF document with an empty signature field using the PdfProcessing library in a Document Processing environment.
4+
type: how-to
5+
page_title: How to Add an Empty Signature Field to a PDF Document in RadPdfProcessing
6+
slug: create-pdf-with-empty-signature-field-radpdfprocessing
7+
tags: pdfprocessing, document, processing, pdf, signature, field, empty, unsigned
8+
res_type: kb
9+
ticketid: 1687482
10+
---
11+
12+
## Environment
13+
14+
| Version | Product | Author |
15+
| ---- | ---- | ---- |
16+
| 2025.1.205| RadPdfProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|
17+
18+
## Description
19+
Learn how to create a PDF document with an empty signature field, which allows signing the document in any PDF viewer. The document should only contain the empty signature field, and when opened in a viewer, it should provide the option to sign.
20+
21+
## Solution
22+
23+
To create a PDF document with an empty [signature field]({%slug radpdfprocessing-model-interactive-forms-form-fields-signaturefield%}) using [RadPdfProcessing]({%slug radpdfprocessing-overview%}), follow these steps:
24+
25+
1. Create a new PDF document and add a page.
26+
2. Define the rectangle area for the [signature field]({%slug radpdfprocessing-model-interactive-forms-form-fields-signaturefield%}).
27+
3. Create a signature field with a unique name.
28+
4. Add a [widget]({%slug radpdfprocessing-model-annotations-widgets%}) to the signature field and set its size and position.
29+
5. Add the widget to the page's annotations.
30+
6. Save the document to a file.
31+
32+
Here is the complete code snippet:
33+
34+
```csharp
35+
// Create a new PDF document and a page
36+
RadFixedDocument document = new RadFixedDocument();
37+
RadFixedPage page = document.Pages.AddPage();
38+
39+
// Define the rectangle for the signature field
40+
Rect signatureRect = new Rect(50, 700, 200, 50);
41+
42+
// Create the signature field (do not assign a certificate or signature)
43+
SignatureField signatureField = document.AcroForm.FormFields.AddSignature("SignatureFieldUniqueName");
44+
45+
// Add a widget for the signature field and set its position and size
46+
SignatureWidget signatureWidget = signatureField.Widgets.AddWidget();
47+
signatureWidget.Rect = signatureRect;
48+
49+
// Add the widget to the page's annotations
50+
page.Annotations.Add(signatureWidget);
51+
52+
// Save the document
53+
string filePath = "EmptySignatureWidget.pdf";
54+
File.Delete(filePath);
55+
using (var output = new System.IO.FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write))
56+
{
57+
new PdfFormatProvider().Export(document, output, TimeSpan.FromSeconds(10));
58+
}
59+
60+
// Open the PDF
61+
Process.Start(new ProcessStartInfo() { FileName = filePath, UseShellExecute = true });
62+
```
63+
64+
### Notes
65+
- The code creates an empty signature field without assigning a certificate or signature.
66+
- The resulting PDF can be opened in any PDF viewer that supports signing, allowing the user to sign the document.
67+
68+
## See Also
69+
70+
- [Digital Signature]({%slug radpdfprocessing-features-digital-signature%})
71+
- [Signature Field]({%slug radpdfprocessing-model-interactive-forms-form-fields-signaturefield%})
72+
- [Signing an Unsigned PDF Document that Contains a Signature Field with RadPdfProcessing]({%slug pdfprocessing-sign-an-unsigned-pdf%})

0 commit comments

Comments
 (0)