Digital signatures are handled by the Signature object that is part of the Document object. All the digital signature parameters can be set or retrieved using the Signature object.
Additional to the Common Attributes, this object has the following attributes:
Attribute Name |
Description |
Type |
Values |
Default Value |
---|---|---|---|---|
Page |
Page Index where object is located. Page Number is Page Index + 1. |
Integer |
>= 0 |
0 |
Locked |
Object cannot be modified |
Boolean |
True / False |
False |
ParentFullName |
The fully qualified name of this object' s parent object |
String |
||
Left |
Left position in Twips |
Integer |
0 |
|
Top |
Top position in Twips |
Integer |
0 |
|
Right |
Right position in Twips |
Integer |
0 |
|
Bottom |
Bottom position in Twips |
Integer |
0 |
|
LeftF |
Left position in Twips |
Float |
0.00F |
|
TopF |
Top position in Twips |
Float |
0.00F |
|
RightF |
Right position in Twips |
Float |
0.00F |
|
BottomF |
Bottom position in Twips |
Float |
0.00F |
|
Visible |
Object is visible when document is printed |
Boolean |
True / False |
True |
Editable |
Standard PDF attribute that makes the object editable or not in any viewer. |
Boolean |
True / False |
True |
CanActivate |
User can Activate. |
Boolean |
True/False |
True |
Hidden |
Hidden in certain report states |
Integer |
A binary combination of the following values: 1: Hidden in Run mode 2: Hidden in Design mode 4: Reserved value 8: Hidden in Print preview 16: Hidden in Annotation mode |
0: Always visible |
Annotation |
Object is saved as an annotation as opposed to a drawing within the page contents |
Boolean |
True / False |
False for static objects such as lines, polygons and text. True for dynamic objects such as form fields or high-lighters |
BorderColor |
Color for drawing text border. |
Color |
COLORREF (bbggrr) 000000 to FFFFFF or in COLORREF (aabbggrr) 00000000 to FFFFFFFF |
000000 (Solid black) |
BorderWidth |
Width of border around text. |
enum acBorderWidth Units are in points or 12th of an inch. |
0: acBorderWidthNone 1: acBorderWidthSimple 2: acBorderWidthDouble 3: acBorderWidthTriple 4: acBorderWidthQuadruple |
0: acBorderWidthNone |
FileName |
Full path of the image associated with the signature. |
String |
|
NULL |
BitmapWidth |
Width of the image. In pixels. |
Integer |
0 |
|
BitmapHeight |
Height of the image. In pixels. |
Integer |
0 |
|
SignatureHandler *ReadOnly |
Type of signature handler. |
String |
Adobe.PPKMS |
Adobe.PPKMS |
SignatureFilter *ReadOnly |
Optional filter to be used by the application validating the signature. |
String |
adbe.pkcs7.sha1 |
adbe.pkcs7.sha1 |
Reason |
Reason for signing the document. |
String |
NULL |
|
Location |
Physical location where the document was signed. |
String |
NULL |
|
StoreName |
Windows stores digital signatures in "stores", each store having a name. This property can be used to get/set the name of the store if it is different from the default "MY" store. |
String |
"MY" |
|
SignerName |
Friendly name of the digital signature as it appears to the user when the digital certificate is installed on the system. In most cases, this is the full name of the person signing the document. |
String |
NULL |
|
Flags |
Combination of options for how to draw the signature. |
Integer |
Check Table Below |
255: Show all |
Sign |
Defines if the document should be signed using the signature object. |
Boolean |
True / False |
False |
DateFormat |
Formatting string for the date value in the digital certificate. The default value (empty string) displays the date in the default PDF format. |
String |
|
"" |
Flags |
Value (Dec) |
Value (Hex) |
---|---|---|
Hidden Signature |
0 |
0x000000 |
Signer name |
1 |
0x000001 |
Reason for signing |
2 |
0x000002 |
Location |
4 |
0x000004 |
Associated image |
8 |
0x000008 |
Certificate |
16 |
0x000010 |
Date of signing |
32 |
0x000020 |
Signature type |
64 |
0x000040 |
Show all |
255 |
0x0000FF |
Enabling PAdES |
256 |
0x000100 |
Enabling PAdES with LTV support (Long Term Validation) |
512 |
0x000200 |
In the current version of the PDF Creator, only one signature object can be present in the document, future versions might support multiple signatures for each document.
Only if the "Sign" attribute is set to True, it will sign the document with object.
This object uses the DefaultFont attribute of the Document Object for the texts.
<Flags()>
Public Enum FlagsSignature As Integer
SIGNATURE_DISPLAY_SIGNER = &H1
SIGNATURE_DISPLAY_REASON = &H2
SIGNATURE_DISPLAY_LOCATION = &H4
SIGNATURE_DISPLAY_IMAGE = &H8
SIGNATURE_DISPLAY_CERTIFICATE = &H10
SIGNATURE_DISPLAY_DATE = &H20
SIGNATURE_DISPLAY_TYPE = &H40
SIGNATURE_LEVEL_PADES = &H100
SIGNATURE_LEVEL_PADES_LTV = &H200
End Enum
Sub Sample()
' Constants for Activation codes
Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"
Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()
' Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode)
' Set CurrentPage
pdf.CurrentPage = 1
' Create a Digital Signature in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeSignature, "Signature1")
' Define Object
Dim oSignature As ACPDFCREACTIVEX.IacObject = pdf.GetObjectByName("Signature1")
' General Attributes
oSignature("Left") = 1000
oSignature("Right") = 3250
oSignature("Top") = 0
oSignature("Bottom") = 500
' Digital Signature Attributes
oSignature("SignerName") = "Amyuni Technologies"
oSignature("Location") = "Montreal"
oSignature("FileName") = "C:\temp\signature.png"
oSignature("Flags") = FlagsSignature.SIGNATURE_DISPLAY_SIGNER Or FlagsSignature.SIGNATURE_DISPLAY_IMAGE
oSignature("Sign") = True
' Save PDF
pdf.Save("c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView)
End Sub
[Flags]
public enum FlagsSignature
{
SIGNATURE_DISPLAY_SIGNER = 0x001,
SIGNATURE_DISPLAY_REASON = 0x002,
SIGNATURE_DISPLAY_LOCATION = 0x004,
SIGNATURE_DISPLAY_IMAGE = 0x008,
SIGNATURE_DISPLAY_CERTIFICATE = 0x010,
SIGNATURE_DISPLAY_DATE = 0x020,
SIGNATURE_DISPLAY_TYPE = 0x040,
SIGNATURE_LEVEL_PADES = 0x100,
SIGNATURE_LEVEL_PADES_LTV = 0x200
}
static void Sample()
{
// Constants for Activation codes
const string strLicenseTo = "Amyuni PDF Creator Evaluation";
const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initializing PDFCreativeX Object
ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();
// Set license key
pdf.SetLicenseKey(strLicenseTo, strActivationCode);
// Set CurrentPage
pdf.CurrentPage = 1;
// Create a Digital Signature in the current Page
pdf.CreateObject(ACPDFCREACTIVEX.ObjectTypeConstants.acObjectTypeSignature, "Signature1");
// Define Object
ACPDFCREACTIVEX.IacObject oSignature = pdf.GetObjectByName("Signature1");
// General Attributes
oSignature["Left"] = 1000;
oSignature["Right"] = 3250;
oSignature["Top"] = 0;
oSignature["Bottom"] = 500;
// Digital Signature Attributes
oSignature["SignerName"] = "Amyuni Technologies";
oSignature["Location"] = "Montreal";
oSignature["FileName"] = @"C:\temp\signature.png";
oSignature["Flags"] = (int)(FlagsSignature.SIGNATURE_DISPLAY_SIGNER | FlagsSignature.SIGNATURE_DISPLAY_IMAGE);
oSignature("Sign") = true;
// Save PDF
pdf.Save(@"c:\temp\CreatePDFDocument_resulting.pdf", ACPDFCREACTIVEX.FileSaveOptionConstants.acFileSaveView);
}
#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace
using namespace std;
enum FlagsSignature
{
SIGNATURE_DISPLAY_SIGNER = 0x001,
SIGNATURE_DISPLAY_REASON = 0x002,
SIGNATURE_DISPLAY_LOCATION = 0x004,
SIGNATURE_DISPLAY_IMAGE = 0x008,
SIGNATURE_DISPLAY_CERTIFICATE = 0x010,
SIGNATURE_DISPLAY_DATE = 0x020,
SIGNATURE_DISPLAY_TYPE = 0x040,
SIGNATURE_LEVEL_PADES = 0x100,
SIGNATURE_LEVEL_PADES_LTV = 0x200
};
int main()
{
// Constants for Activation codes
bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";
bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";
// Initialize the COM subsystem
CoInitialize(0);
// IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,
// the type library header file generated by the #import instruction above
IPDFCreactiveXPtr pdf;
// Create the PDFCreactiveX instance
pdf.CreateInstance(__uuidof(PDFCreactiveX));
// set license key
pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));
// Set CurrentPage
pdf->CurrentPage = 1;
// Create a Digital Signature in the current Page
pdf->CreateObject(acObjectTypeSignature, "Signature1");
// Define Object
IacObjectPtr oSignature = pdf->GetObjectByName("Signature1");
// General Attributes
oSignature->Attribute["Left"] = 1000;
oSignature->Attribute["Right"] = 3250;
oSignature->Attribute["Top"] = 0;
oSignature->Attribute["Bottom"] = 500;
// Digital Signature Attributes
oSignature->Attribute["SignerName"] = "Amyuni Technologies";
oSignature->Attribute["Location"] = "Montreal";
oSignature->Attribute["FileName"] = "C:\\temp\\signature.png";
oSignature->Attribute["Flags"] = SIGNATURE_DISPLAY_SIGNER | SIGNATURE_DISPLAY_IMAGE;
oSignature->Attribute["Sign"] = TRUE;
// Save PDF
pdf->Save("c:\\temp\\CreatePDFDocument_resulting.pdf", acFileSaveView);
// destroy objects
pdf = NULL;
oSignature = NULL;
return 0;
}
' FlagsSignature
Const SIGNATURE_DISPLAY_SIGNER = 1
Const SIGNATURE_DISPLAY_REASON = 2
Const SIGNATURE_DISPLAY_LOCATION = 4
Const SIGNATURE_DISPLAY_IMAGE = 8
Const SIGNATURE_DISPLAY_CERTIFICATE = 16
Const SIGNATURE_DISPLAY_DATE = 32
Const SIGNATURE_DISPLAY_TYPE = 64
Const SIGNATURE_LEVEL_PADES = 256
Const SIGNATURE_LEVEL_PADES_LTV = 512
' ObjectTypeConstants
Const acObjectTypeArrow = 36
Const acObjectTypeBarcode = 45
Const acObjectTypeCell = 33
Const acObjectTypeCheckBox = 21
Const acObjectTypeEllipse = 4
Const acObjectTypeExcel = 17
Const acObjectTypeField = 6
Const acObjectTypeGraph = 19
Const acObjectTypeHighlight = 23
Const acObjectTypeLine = 1
Const acObjectTypePicture = 7
Const acObjectTypePolygon = 8
Const acObjectTypeRoundFrame = 3
Const acObjectTypeRow = 32
Const acObjectTypeSelection = 24
Const acObjectTypeSignature = 39
Const acObjectTypeStickyNote = 22
Const acObjectTypeTable = 16
Const acObjectTypeText = 5
' acBorderWidth
Const acBorderWidthNone = 0
Const acBorderWidthSimple = 1
Const acBorderWidthDouble = 2
Const acBorderWidthTriple = 3
Const acBorderWidthQuadruple = 4
' FileSaveOptionConstants
Const acFileSaveAll = 0
Const acFileSaveDefault = -1
Const acFileSaveView = 1
Const acFileSaveDesign = 2
Const acFileSavePDFA_7 = 3
Const acFileSavePDFA = 4
Const acFileSavePDF14 = 5
' Constants for Activation codes
Const strLicenseTo = "Amyuni PDF Creator Evaluation"
Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"
' Initializing PDFCreativeX Object
Dim pdf
Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.5")
' Set license key
pdf.SetLicenseKey strLicenseTo, strActivationCode
' Set CurrentPage
pdf.CurrentPage = 1
' Create a Digital Signature in the current Page
pdf.CreateObject acObjectTypeSignature, "Signature1"
' Define Object
Dim oSignature
Set oSignature = pdf.GetObjectByName("Signature1")
' General Attributes
oSignature("Left") = 1000
oSignature("Right") = 3250
oSignature("Top") = 0
oSignature("Bottom") = 500
' Digital Signature Attributes
oSignature("SignerName") = "Amyuni Technologies"
oSignature("Location") = "Montreal"
oSignature("FileName") = "C:\temp\signature.png"
oSignature("Flags") = SIGNATURE_DISPLAY_SIGNER Or SIGNATURE_DISPLAY_IMAGE
oSignature("Sign") = True
' Save PDF
pdf.Save "c:\temp\CreatePDFDocument_resulting.pdf", acFileSaveView
' destroy Objects
Set pdf = Nothing
Set oSignature = Nothing