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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -