Encrypt PDF in VFP

I need to be able to encrypt PDF documents in VFP programatically and then create a zip file with the encrypted PDF to email

Please assist.

Thanks
Shamina MaharajSoftware DeveloperAsked:
Who is Participating?
 
pcelbaConnect With a Mentor Commented:
Additional option is to create PDF in VFP directly. You may use free FoxyPreviewer (https://archive.codeplex.com/?p=foxypreviewer) or paid XFRX (http://eqeus.com/) to generate encrypted PDFs from VFP report directly.

FoxyPreviewer should be moved to GitHub soon.
1
 
bbaoIT ConsultantCommented:
i would suggest this is to be done by calling command-line command from VFP instead of programming VFP to do so, simply because (1) VFP has been discontinued for a long while (10 years?) hence no update APIs or add-ons using latest algorithm in data encrypting, PDF generating and file compressing, and (2) not efficient to handle that using VFP.
0
 
Olaf DoschkeSoftware DeveloperCommented:
There are many levels on which encryption or cryptography could be applied. Are the specs really asking you to encrypt the whole PDF? Just like with XML can have encrypted values inside nonencrypted XML tags, a PDF can still be a PDF and have encrypted content, so it still opens in a PDF viewer and causes a login dialog there. VFP has no means to do that on its own, you depend on third-party PDF tools just like you generate PDF with a PDF printer and not with direct VFP code. It may even be just an option of a PDF printer to produce an encrypted PDF with a given key, certificate, or password. So look around and ask about such tools in general, this is not only for VFP.

To encrypt any files, that can be done separately or while zipping it. 7zip has options for that not only in its user interface, also as command options of 7z.exe, eg -ppassword for creating an AES encrypted zip archive.

If this is related to syncing files, notice anything you transfer via shared resources of a remote desktop connection is already protected with SSL as your typical remote connection is done via secured VPN SSL tunnel, so there actually is no need to encrypt files before transferring them, they are transfer encrypted anyway.

Bye, Olaf.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
pcelbaCommented:
Free VFP Add-on libraries which can achieve your requirements exist already:

VFPEncryption can encrypt/decrypt any file or string: https://www.sweetpotatosoftware.com/blog/index.php/2009/08/09/major-vfp-encryption-update/

VFPCompression can create a ZIP file from string, file, or folder and also encrypt this ZIP in a way compatible with WinZIP:
https://www.sweetpotatosoftware.com/blog/index.php/2008/12/01/vfpcompression-update-fix-and-zipfile-comment-support/
0
 
jrbbldrCommented:
You need to ask yourself if you really need to ENCRYPT the PDF file itself or do you merely need to make it more difficult for the file to be opened and viewed.

If you only need to make it more difficult for the file to be opened and viewed - then you can Password protect the ZIP file containing the non-encrypted PDF.

However if you should need to actually ENCRYPT the PDF file itself, you might want to consider using GPGWin  ( https://www.gpg4win.org/GPGWin ).   It is a much easier to use version of the PGP encryption.
NOTE:  If you use it, you will need to share a 'key' with the recipient so that they can un-encrypt the file when they get it.

I used GPGWin on a project where the recipient was a LARGE company that felt that it needed to SECURE the file and its contents until they received it on their end.   On their end, they were using PGP and they had no difficulty handling the encrypted files that I sent to them.

Good Luck
0
 
Olaf DoschkeSoftware DeveloperCommented:
A password protected 7zip file just like WinZip means AES256 encryption. This is strong enough.

Bye, Olaf.
0
 
pcelbaCommented:
Hi Shamina Maharaj,

did you find the solution from the answers? Do you have additional questions?

TIA
Pavel
0
 
pcelbaConnect With a Mentor Commented:
Just for update - New Foxypreviewer web page is http://www.foxypreviewer.com/
1
 
Shamina MaharajSoftware DeveloperAuthor Commented:
Thanks guys, FoxyPreviewer has a built in encryption method which I've used to resolve the problem. Thank you for all the assistance
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.