Pdf encryption

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Pdf encryption

Postby simonlec » Wed Jan 29, 2014 5:14 pm

Hi,
I created a vpe document with the encryption method.
This is my code to set the encryption:
VpeCtrl.Encryption = 1;
VpeCtrl.EncryptionKeyLength = 128;
VpeCtrl.Protection = 4;
VpeCtrl.UserPassword = 'test';

I ran my vpe and I saved it to a pdf file.
When I opened the pdf on my window 7, Adobde Reader asked me to type the password to view the pdf file.
When I opened the same pdf file on my Ipad, no password is requested and I can see the content of the pdf file.
This is an Apple or not?
Thanks a lot
simonlec
 
Posts: 32
Joined: Wed Jul 30, 2008 6:50 pm

Re: Pdf encryption

Postby IDEAL Software Support » Fri Jan 31, 2014 8:02 am

Set the owner password also.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Re: Pdf encryption

Postby IDEAL Software Support » Fri Jan 31, 2014 8:11 am

You need to specify Acrobat 5 as minimum version, to gain 128-bit encryption.
I also do recommend that you are using the constants we have defined, i.e.:

VpeCtrl.PDFVersion = VPE_PDF_ACROBAT_5;
VpeCtrl.Encryption = DOC_ENCRYPT_STREAM;
VpeCtrl.EncryptionKeyLength = 128;
VpeCtrl.Protection = PDF_ALLOW_PRINT;
VpeCtrl.UserPassword = 'test';
VpeCtrl.OwnerPassword = 'test';

Using the predefined constants offers numerous advantages:
Using the constants will help others to understand your source code at a glance.
It will also help yourself, if you are reading your source code in a year.
If we ever should change a value of a constant, your source code will be compatible.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 14 guests