Skip to content

Commit e6a01c3

Browse files
committed
applied Yoan's feedback
1 parent 933cd61 commit e6a01c3

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

knowledge-base/pdfprocessing-sign-an-unsigned-pdf.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: Signing an Unsigned PDF Document that Contains a Digital Signature with RadPdfProcessing
3-
description: This article provides a guide on how to add signatures and images to PDF documents programmatically using RadPdfProcessing.
2+
title: Signing an Unsigned PDF Document that Contains a Signature Field with RadPdfProcessing
3+
description: This article provides a guide on how to sign an empty signature field by using text and image programmatically using RadPdfProcessing.
44
type: how-to
5-
page_title: Signing a PDF Document that Contains a Digital Signature with RadPdfProcessing
5+
page_title: Signing a PDF Document that Contains a Signature Field with RadPdfProcessing
66
slug: pdfprocessing-sign-an-unsigned-pdf
7-
tags: processing, pdf, sign, image, document, digital
7+
tags: processing, pdf, sign, image, document, digital, signature, field, empty
88
res_type: kb
99
ticketid: 1676495
1010
---
@@ -17,20 +17,20 @@ ticketid: 1676495
1717

1818
## Description
1919

20-
This tutorial demonstrates how to import an unsigned PDF containing a [signature]({%slug radpdfprocessing-features-digital-signature%}) and sign it using [RadPdfProcessing]({%slug radpdfprocessing-overview%}).
20+
This tutorial demonstrates how to import an unsigned PDF containing a [signature field]({%slug radpdfprocessing-features-digital-signature%}) and sign it using [RadPdfProcessing]({%slug radpdfprocessing-overview%}).
2121

2222
![Sign an Unsigned PDF](images/sign-an-unsigned-pdf.png)
2323

2424
## Solution
2525
To add signatures and images to PDF documents and ensure the signed version correctly overwrites an existing file, follow these steps:
2626

27-
1. **Check if the Document is Already Signed**: Before adding a new signature, it's essential to check if the document is already signed. This can be done by iterating through the form fields and checking for signature fields.
27+
1. **Check if the Document is Already Signed**: Before signing the signature field, it's essential to check if the document is already signed. This can be done by iterating through the form fields and checking for signature fields.
2828

29-
2. **Prepare the Document for Signing**: Load the document into a `RadFixedDocument` object using the `PdfFormatProvider.Import` method. If the document already contains a signature field, you will need to access this field to add the signature.
29+
2. **Prepare the Document for Signing**: Load the document into a `RadFixedDocument` object using the `PdfFormatProvider.Import` method. If the document already contains an empty signature field, you will need to access this field and sign it.
3030

3131
3. **Add the Signature**: Use a certificate to sign the document. The `SignatureField.Signature` property allows you to assign a new `Signature` object, which is created using the certificate.
3232

33-
4. **Add an Image**: To insert an image, such as a signature graphic, use a `FixedContentEditor` on the desired page and use the `DrawBlock` method. The image can be loaded from a file using a `FileStream` and added to a `Block` object.
33+
4. **Add an Image**: To insert an image, such as a signature graphic, use a `FixedContentEditor` on the desired **FormSource** and use the `DrawBlock` method. The image can be loaded from a file using a `FileStream` and added to a `Block` object.
3434

3535
5. **Export the Signed Document**: Before exporting the signed document, delete the previous version of the file if it exists. This step is crucial to avoid permission issues or structure mismatches in the PDF file. Use the `PdfFormatProvider.Export` method to save the signed document.
3636

@@ -56,25 +56,25 @@ Below is a sample code snippet demonstrating these steps:
5656
if (widget != null)
5757
{
5858
formSource = widget.Content.NormalContentSource;
59-
FixedContentEditor ed = new FixedContentEditor(formSource);
60-
ed.TextProperties.FontSize = 30;
61-
ed.Position.Translate(30, 0);
62-
ed.DrawText("John Doe");
63-
ed.Position.Translate(200, 5);
59+
FixedContentEditor fixedContentEditor = new FixedContentEditor(formSource);
60+
fixedContentEditor.TextProperties.FontSize = 30;
61+
fixedContentEditor.Position.Translate(30, 0);
62+
fixedContentEditor.DrawText("John Doe");
63+
fixedContentEditor.Position.Translate(200, 5);
6464

6565
FileStream fileStream = new FileStream("ProgressNinjas.png", FileMode.Open);
6666
ImageSource _imageSource = new ImageSource(fileStream);
6767
Block imageBlock = new Block();
6868
imageBlock.InsertImage(_imageSource);
69-
ed.DrawBlock(imageBlock);
69+
fixedContentEditor.DrawBlock(imageBlock);
7070

7171

72-
ed.Position.Translate(0, 90);
73-
ed.TextProperties.FontSize = 20;
74-
ed.DrawText("Digitally signed on: " + DateTime.Now.ToString());
75-
ed.Position.Translate(40, 120);
76-
ed.TextProperties.FontSize = 20;
77-
ed.DrawText("(Click here to view the signature info)");
72+
fixedContentEditor.Position.Translate(0, 90);
73+
fixedContentEditor.TextProperties.FontSize = 20;
74+
fixedContentEditor.DrawText("Digitally signed on: " + DateTime.Now.ToString());
75+
fixedContentEditor.Position.Translate(40, 120);
76+
fixedContentEditor.TextProperties.FontSize = 20;
77+
fixedContentEditor.DrawText("(Click here to view the signature info)");
7878
}
7979

8080
document.Pages[0].Annotations.Add(widget);

0 commit comments

Comments
 (0)