PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllThis property gets or sets protection key length.
|
| TxCryptoKeyLength ProtectionKeyLength { get; set; } |
Value
Remarks
ProtectionKeyLength specifies the encryption key length as 40-bit or 128-bit. 128-bit keys are supported in the PDF format version 1.5 and later.
Equivalent in new interface: IPDFDocument4::DocumentEncryption.
Example
How to Protect a PDF Document
Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.ProtectionEnabled := true;
PDF.ProtectionKeyLength := ckl128;
PDF.UserPassword = 'userpassword';
PDF.OwnerPassword = 'superpassword';
PDF.ProtectionOptions_coCopyInformation := false;
PDF.ProtectionOptions_coModifyAnnotation := false;
PDF.ProtectionOptions_coModifyStructure := false;
PDF.ProtectionOptions_coPrint := false;
PDF.BeginDoc;
{ some document generating code here... }
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created PDF->ProtectionEnabled = TRUE; PDF->ProtectionKeyLength = ckl128; PDF->UserPassword = "userpassword"; PDF->OwnerPassword = "superpassword"; PDF->ProtectionOptions_coCopyInformation = FALSE; PDF->ProtectionOptions_coModifyAnnotation = FALSE; PDF->ProtectionOptions_coModifyStructure = FALSE; PDF->ProtectionOptions_coPrint = false; PDF.BeginDoc(); // some document generating code here... PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created PDF.ProtectionEnabled = true; PDF.ProtectionKeyLength = TxCryptoKeyLength.ckl128; PDF.UserPassword = "userpassword"; PDF.OwnerPassword = "superpassword"; PDF.ProtectionOptions_coCopyInformation = false; PDF.ProtectionOptions_coModifyAnnotation = false; PDF.ProtectionOptions_coModifyStructure = false; PDF.ProtectionOptions_coPrint = false; PDF.BeginDoc(); // some document generating code here... PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created PDF.ProtectionEnabled = True PDF.ProtectionKeyLength = 1 'ckl128 PDF.UserPassword = "userpassword" PDF.OwnerPassword = "superpassword" PDF.ProtectionOptions_coCopyInformation = False PDF.ProtectionOptions_coModifyAnnotation = False PDF.ProtectionOptions_coModifyStructure = False PDF.ProtectionOptions_coPrint = False PDF.BeginDoc ' some document generating code here... PDF.EndDoc
See Also
Reference


