cete.dynamicpdf.pageelements.forms.signature
Signature
- Namespace: ceTe.DynamicPDF.PageElements.Forms
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a Signature form field.
public class Signature : FormElement, ISerializable
Public Class Signature
Inherits FormElement
Implements ISerializable
Inheritance: Object → PageElement → TaggablePageElement → FormElement → Signature
Implements: ISerializable
Licensing
This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
This example shows how to create a signature and sign it with a certificate.
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.Forms
Imports ceTe.DynamicPDF.Text
Module Module1
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a PDF Page
Dim MyPage As Page = New Page
' Create a signature form field
Dim MySignature As Signature = New Signature("MySigField", 10, 10, 300, 100)
Dim MyFont As OpenTypeFont = new OpenTypeFont("fontname")
MySignature.Font = MyFont
' Set a full background image
MySignature.FullPanel.SetImage("C:\MyImage.gif")
' Set new color property for the left panel text
MySignature.LeftPanel.TextColor = RgbColor.Red
' Add signature field to the page
MyPage.Elements.Add(MySignature)
' Add the page to the document
MyDocument.Pages.Add(MyPage)
' Create a Certificate
Dim MyCertificate As Certificate = New Certificate("C:\PersonalCertificate.pfx", "MyPassword")
' Add an Invisible Signature (Signing the document)
MyDocument.Sign("MySigField", MyCertificate)
' Save the document
MyDocument.Draw("C:\MySignedDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.Forms;
using ceTe.DynamicPDF.Text;
class MyClass
{
static void Main(string[] args)
{
// Create a PDF Document
Document document = new Document();
// Create a PDF Page
Page page = new Page();
// Create a signature form field
Signature signature = new Signature("MySigField", 10, 10, 300, 100);
OpenTypeFont myFont = new OpenTypeFont("fontname");
signature.Font = myFont;
// Set a full background image
signature.FullPanel.SetImage(@"C:\MyImage.gif");
// Set new color property for the left panel text
signature.LeftPanel.TextColor = RgbColor.Red;
// Add signature field to the page
page.Elements.Add(signature);
// Add the page to the document
document.Pages.Add(page);
// Create a Certificate from the file
Certificate certificate = new Certificate(@"c:\MyPersonalCertificate.pfx", "MyPassword");
// Sign the document refering the sign field
document.Sign("MySigField", certificate);
// Save the document
document.Draw(@"C:\MySignedDocument.pdf");
}
}
Remarks
NOTE: This class required the .NET Framework 2.0 or greater.
The signature can be of visible or invisible. Use this constructor to create a visible signature field. For creating a invisible field refer Sign . A signature field that does not have corresponding entry at Signwill behave as empty signature field and can be signed later. The visible signature field is divided into three panels.
- Left or Top Panel By default this panel holds the subject name of the given certificate.
- Right or Bottom Panel This panel is set to hold information related with certificate and the signer.
- Full Panel This panel constitues complete area of the signature. It does not hold any default values, but can be used to show up full area text or image.
Constructors
Signature(String, Single, Single, Single, Single)
Intializes a new instance of the signature.
public Signature(string name, float x, float y, float width, float height)
Public Sub New (name As String, x As Single, y As Single, width As Single, height As Single)
Parameters
- name: String
Name of a signature field.
- x: Single
X coordinate of a signature.
- y: Single
Y coordinate of a signature.
- width: Single
Widht of a signature.
- height: Single
Height of a signature.
Remarks
NOTE: This class required the .NET Framework 2.0 or greater.
Assigning zero to x,y,height and width will make the signature as invisible althougth required resources will be added. This method is not recommended and advised to call Sign(System.String,ceTe.DynamicPDF.Certificate) directly without adding any signature field with corresponding name.
Properties
BackgroundColor
Gets or Sets the fill/background color of a form field. (Inherited from FormElement)
public RgbColor BackgroundColor { get; set; }
Public Property BackgroundColor As RgbColor
Property Value
BorderColor
Gets or Sets the border color of a form field. (Inherited from FormElement)
public DeviceColor BorderColor { get; set; }
Public Property BorderColor As DeviceColor
Property Value
BorderStyle
Gets or Sets the BorderStyle . (Inherited from FormElement)
public BorderStyle BorderStyle { get; set; }
Public Property BorderStyle As BorderStyle
Property Value
Font
Gets or sets Font .
public Font Font { get; set; }
Public Property Font As Font
Property Value
FullPanel
Gets the SignaturePanel for the full panel.
public SignaturePanel FullPanel { get; }
Public Property FullPanel As SignaturePanel
Property Value
Height
Gets or Sets the height of a form field. (Inherited from FormElement)
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
LeftPanel
Gets the SignaturePanel for the left panel.
public SignaturePanel LeftPanel { get; }
Public Property LeftPanel As SignaturePanel
Property Value
Location
Gets or sets a value indicating the location of signing.
public string Location { get; set; }
Public Property Location As String
Property Value
MappingName
Gets or Sets an mapping name, of a form field. (Inherited from FormElement)
public string MappingName { get; set; }
Public Property MappingName As String
Property Value
Name
Gets or Sets the name of a form field. (Inherited from FormElement)
public string Name { get; set; }
Public Property Name As String
Property Value
PanelLayout
Gets or sets the SignaturePanelLayout specifying how the panels should be laidout.
public SignaturePanelLayout PanelLayout { get; set; }
Public Property PanelLayout As SignaturePanelLayout
Property Value
Printable
Gets or Sets the form field printable on pdf. By default its true. (Inherited from FormElement)
public bool Printable { get; set; }
Public Property Printable As Boolean
Property Value
ReadOnly
Gets or Sets the read only property status of the form field. (Inherited from FormElement)
public bool ReadOnly { get; set; }
Public Property ReadOnly As Boolean
Property Value
Reason
Gets or sets a value indicating the reason of signing the document.
public string Reason { get; set; }
Public Property Reason As String
Property Value
RightPanel
Gets the SignaturePanel for the right panel.
public SignaturePanel RightPanel { get; }
Public Property RightPanel As SignaturePanel
Property Value
Rotate
Gets or Sets the angle of a form field. Rotation angle should be multiple of 90, default is 0. (Inherited from FormElement)
public int Rotate { get; set; }
Public Property Rotate As Int32
Property Value
Tag
Gets or sets the structure element of the form element. (Inherited from FormElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
TextColor
Gets or Sets the color of the text for the field. (Inherited from FormElement)
public DeviceColor TextColor { get; set; }
Public Property TextColor As DeviceColor
Property Value
ToolTip
Gets or Sets an alternate field name, of a form field. (Inherited from FormElement)
public string ToolTip { get; set; }
Public Property ToolTip As String
Property Value
Visible
Gets or Sets the form field visible on pdf. By default its true. (Inherited from FormElement)
public bool Visible { get; set; }
Public Property Visible As Boolean
Property Value
Width
Gets or Sets the width of a form field. (Inherited from FormElement)
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or Sets the X coordinate of a form field. (Inherited from FormElement)
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or Sets the Y coordinate of a form field. (Inherited from FormElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the signature to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the signature's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
HideAllText()
Hides all text visibility in all the panels.
public void HideAllText()
Sub HideAllText()
Remarks
Sets the custom text in all panels to null if any set.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .