php - Password protected PDF creation using Ghostscript -


i need provide password pdf file using ghostscript in php. have pdf file called sample.pdf. need put protection , call output.pdf. searched lot , got following lines of codes. doesn't helped me. there error in code? suggestion appreciated..

 exec("gs -dnopause -dbatch -sdevice=pswrite -soutputfile=file.ps sample.pdf");  exec("gs -dnopause -dbatch -sownerpassword=pwd1 -suserpassword=pwd2 -sdevice=pdfwrite -soutputfile=output.pdf file.ps"); 

running command lines have given works here me. here questions:

1) have tried command line instead of 'exec' php ?

2) why first running pswrite, pdfwrite ? give poor quality

3) version of ghostscript using ?

4) in way not work ? how testing existence of password security ?


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -