40/128 Bit PDF Encryption API

With the Aloaha PDF Encryption API it is also possible to set 40/128 Bit based PDF permissions. The ownwer password can be overwritten/resetted without nowing the original password. 

Please find some sample VBS based code below 

'Sample code to encrypt or decrypt a document with 40/128 Bit encryption
'New PDF permissions can be set/resetted without actually knowing the original Owner Password
'Copyright 2005 by Wrocklage Intermedia GmbH
'Coded by Stefan Engelbert
'The API Version of the Aloaha PDF Crypter is required for this API! 


Dim sourcefile
Dim targetfile
Dim pdf 

'Can .... Variables can be 0 or 1
Dim CanPrint
Dim CanCopy
Dim CanChange
Dim CanAddNotes
Dim CanFillFields
Dim CanCopyAccess
Dim CanAssemble
Dim CanPrintFull 

'eBits can be 0, 40 or 128
Dim eBits 

'New Passwords - can also be left empty strings
Dim NewUserPW
Dim NewOwnerPW

sourcefile = "c:\birth.pdf"
targetfile = "c:\newbirth.pdf"
Set pdf = CreateObject("aloahapdf.edit")

If pdf.load_pdf_to_mem(CStr(sourcefile))=true Then

     'set new owner and user password.
     'leave both password empty to decrypt document 
     NewOwnerPW = "test123"
     NewUserPW = "password"
     'Allow Printing
     CanPrint = 1
     eBits=128
     Call pdf.set_permission(CLng(CanPrint), CLng(CanCopy), CLng(CanChange), CLng(CanAddNotes), CLng(CanFillFields), CLng(CanCopyAccess), CLng(CanAssemble), CLng(CanPrintFull), CLng(eBits), CStr(NewUserPW), CStr(NewOwnerPW))
     Call pdf.save_pdf_to_file(CStr(targetfile))
Else
     MsgBox "Could not load PDF Document"
End If


Set pdf = nothing



Download the code sample below:
 40_128.vbs (1,22 KB)

Aloaha Software / Knowledge Base / PDF SDK / PDF Encryption API / 40/128 Bit encryption

No evaluation Key Required!

To evaluate this API just install one of our Aloaha PDF Products or our SDK Version from http://www.aloaha.com/download/sdk.zip
There is no evaluation key required!

PDF Cryper Forum


create PDF Software

40/128 Bit encryption

Any questions?
Aloaha Software - 40/128 Bit encryption
ProductsKnowledge BaseShopSupportPress
Deutsche VersionEnglish version