Last active
June 6, 2017 12:08
-
-
Save deselbi/dd7184dcaed8891f1eb0b5cc7379ce98 to your computer and use it in GitHub Desktop.
Encrypt PDF created with laravel DOMPDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use \PDF; | |
use Symfony\Component\Process\InputStream; | |
use Symfony\Component\Process\Process; | |
... | |
$pdf = PDF::loadHTML($html); | |
$stream = $pdf->stream(); | |
$input = new InputStream(); | |
$command = 'pdftk - output - user_pw '.$password; | |
$process = new Process($command); | |
$process->setInput($input); | |
$process->start(); | |
$input->write($stream->content()); | |
$input->close(); | |
$process->wait(); | |
$encriptedPdfContent = $process->getOutput(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment