Laravel PDF Protect (fork)
Simple wrapper package around MPDF's setProtection
method that allows you to set password on PDF files.
Installation
You can install the package via composer:
composer require devraeph/laravel-pdf-protect
Usage
You can use via Facade like so:
PdfPasswordProtect::encrypt(storage_path('pdf/document.pdf'),storage_path('pdf/'.'encrypted-documented.pdf'),'janedoe');
Encrypt method in detail
- $inputFile and $outputFile has to be a path like
storage_path("pdf/document.pdf")
PdfPasswordProtect::encrypt($inputFile,outputFile,$password)
The final file will be located in storage/pdf
as encrypted-document.pdf
Testing
composer test
Credits
- Owen Jubilant (creator of the original package) - PDF Password Protect
- DevRaeph (refactored classes to comply with PSR-4)
License
The MIT License (MIT).