Link to home
Start Free TrialLog in
Avatar of hrvica5
hrvica5Flag for Croatia

asked on

Set password on PDF file

Hi,

Is there any way to set passsword on PDF file.

Thank you, H
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Hi H,

Here's a five-minute EE video Micro Tutorial that shows how to do it:

How to password-protect a PDF with free software - PDF-XChange Editor

Regards, Joe
Avatar of hrvica5

ASKER

Thank you Joe,  but I need dinamicaly create password through Delphi.
Is it possible?

Thank you, H
Ah, sorry, missed your Delphi Topic. When I need to do it programmatically, I call a command line utility, which you can do easily with Delphi. I have a developer's license for the one that I use (expensive), but a good free one is PDFtk Server:
http://www.pdflabs.com/tools/pdftk-server/

I used that for many years before switching to the non-free one. Don't be misled by "Server" in the name. I don't know why they called it that, but it's just an executable (pdftk.exe, with a supporting DLL, libiconv2.dll) that runs on "standard" Windows — it does not have to run on a "server" Windows.

The full syntax for the PDFtk Server command line and some usage examples are here:
http://www.pdflabs.com/docs/pdftk-man-page/
http://www.pdflabs.com/docs/pdftk-cli-examples/

The two password options are:
[ owner_pw <owner password | PROMPT> ]
[ user_pw <user password | PROMPT> ]

As a disclaimer, I want to emphasize that I have no affiliation with this company and no financial interest in it whatsoever. I am simply a happy user/customer. Regards, Joe
Avatar of skullnobrains
skullnobrains

the above will help. that said pdf encryption is rather easy to break, so you might consider other ways such as sticking the pdf file in an encrypted archive. 7zip features lzma encryption
Hi H,
skullnobrains makes a good point, and note that 7-Zip also comes in a command line version that you can call from your Delphi code...actually, there are two versions...7za.exe, which supports only 7z, xz, lzma, cab, zip, gzip, bzip2, and tar formats...and 7z.exe, which supports several other formats, but requires the 7z.dll module (that's the advantage of 7za.exe...it is a stand-alone executable that doesn't require any external modules). Regards, Joe
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
licensed does not mean $$. think of creative common, apache, bsd, SPL... even gnu is usually free, though it does come with a bunch of restrictions.