Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to remove a Password from a PDF file using PHP?

Tags:

php

passwords

pdf

I would like to ask if it's possible to use PHP in removing a password from a password-protected PDF file in which I already know the password? I've seen this page which provides many options but using bash script. :( I was required to use PHP as much as possible. Any suggestions appreciated!

like image 696
dsdeiz Avatar asked Jun 01 '10 13:06

dsdeiz


1 Answers

Of course it's possible, all you need to do is reverse engineer the encryption and compression and implement the reverse operations in PHP - but why bother:

<?php
   `gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf`;
?>

C.

like image 106
symcbean Avatar answered Nov 15 '22 00:11

symcbean