Hi,
I'm trying to use the PDF Converter 2.1 to encrypt a document in 128 bit. And I just can't find the way to do it... I can't understand the link between the "Document.encrypt" method and the "FileNameOptions" property.
Please Help me! A code example would be really appreciated.
Many thanks.
Daniel
[Solved] 128 bit PDF encrypting
-
- Posts: 21
- Joined: Tue Apr 29 2003
- Location: Montreal, Quebec
Hello,
Here is a VB sample on generating an encrypted pdf file using 128 bits encryption:
Have a nice day !
Here is a VB sample on generating an encrypted pdf file using 128 bits encryption:
I will move this thread to the VB forum as It can help VB Developers too.Const NoPrompt As Long = 1
Const UseFileName As Long = 2
Const EncryptDocument128 = &H40000000
Private Sub cmdEncryptEmail_Click()
On Error GoTo printer_error
Set PDF = New CDIntfEx.CDIntfEx
PDF.DriverInit "Amyuni Document Converter"
PDF.DefaultDirectory = "c:\temp"
PDF.DefaultFileName = "c:\temp\sample.pdf"
'encryption
PDF.OwnerPassword = "owner"
PDF.UserPassword = "user"
PDF.Permissions = -64
PDF.FileNameOptionsEx = NoPrompt + UseFileName + EncryptDocument128
PDF.SetDefaultPrinter
PDF.EnablePrinter "License to", "xxxxxxx"
'print stuff ......
Exit Sub
printer_error:
MsgBox "Printer not found"
End Sub
Have a nice day !
-
- Posts: 21
- Joined: Tue Apr 29 2003
- Location: Montreal, Quebec
Hello Daniel,
I guess I replied too quickly.
You can encrypt a pdf file that is already generated by the PDF Converter using the DLL interface of CDIntf.
A new function is added to CDintf, it is EncryptPDFDocument128(). Here is its declaration in VB:
Declare Function EncryptPDFDocument128 Lib "CDIntf210" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long
Hope this helps.
I guess I replied too quickly.
You can encrypt a pdf file that is already generated by the PDF Converter using the DLL interface of CDIntf.
A new function is added to CDintf, it is EncryptPDFDocument128(). Here is its declaration in VB:
Declare Function EncryptPDFDocument128 Lib "CDIntf210" (ByVal FileName As String, ByVal Owner As String, ByVal User As String, ByVal Permissions As Long) As Long
Hope this helps.