In a VB application i have tried to crypt a document with the following lines of code:
Code: Select all
' set the permanent license key for the product
Declare Function SetLicenseKey Lib "CDIntf250" Alias "SetLicenseKeyA" (ByVal szCompany As String, ByVal szLicKey As String) As Long
' encrypt PDF document
Declare Function EncryptPDFDocument Lib "CDIntf250" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long
Declare Function EncryptPDFDocument128 Lib "CDIntf250" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long
Public Sub DllEcryption(...)
'******* Encrypt a pdf file after it is generated *****
' SetLicenseKey is needed with some advanced funtions like Encryption
SetLicenseKey LicensedTo, ActivationCode
If b128Bits Then
' EncryptPDFDocument128 can be used for 128 bits encryption.
EncryptPDFDocument128 sPDFFileName, sOwner, sUser, -64 + 4
Else
' Protect a document using 40-bits encryption, enable the user to print(4)
EncryptPDFDocument sPDFFileName, sOwner, sUser, -64 + 4
End If
End Sub
- a white document, if the original document were composed of one single page.
- the first page full and the other ones white, if the original document were composed more pages.
The result of EncryptPDF... function is 1.
While the PDF Generation running very well.
How is possible?
I thank in advance for whichever aid you can give to me.