Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/owen-oj/pdf-password-protect

Laravel package to password-protect all pages in PDFs.
https://github.com/owen-oj/pdf-password-protect

laravel laravel-pdf laravel-pdf-password laravel-pdf-password-protect laravel9 password-protect-pdf pdf pdf-encryption pdf-password protect-pdfs

Last synced: 2 days ago
JSON representation

Laravel package to password-protect all pages in PDFs.

Awesome Lists containing this project

README

        

# Laravel PDF Password Protect

[![Latest Version on Packagist](https://img.shields.io/packagist/v/owenoj/pdf-password-protect.svg?style=flat-square)](https://packagist.org/packages/owenoj/pdf-password-protect)
[![Total Downloads](https://img.shields.io/packagist/dt/owenoj/pdf-password-protect.svg?style=flat-square)](https://packagist.org/packages/owenoj/pdf-password-protect)

Simple wrapper package around MPDF's `setProtection` method that allows you to set password on PDF files.

[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/kkoj)

## Installation

You can install the package via composer:

```bash
composer require owenoj/pdf-password-protect
```

## Usage

You can use via Facade like so:

```php
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

```bash
composer test
```

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Owen Jubilant](https://github.com/owen-oj)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

## Laravel Package Boilerplate

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).