From 662f9de8287a0c67df8d33fdf963aa2bde2b5ada Mon Sep 17 00:00:00 2001 From: Patrick Organ Date: Sat, 22 Jun 2024 10:59:47 -0400 Subject: [PATCH] update docs --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 6e80138..1378a0f 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,16 @@ $pdf->layerMethod(\Spatie\PdfToImage\Enums\LayerMethod::Merge); $pdf->layerMethod(\Spatie\PdfToImage\Enums\LayerMethod::None); ``` +Set resource limits for Imagick: + +```php +// set memory limit to 128 MB: +$pdf->resourceLimit(\Spatie\PdfToImage\Enums\ResourceLimitType::Memory, 134217728); + +// set thread limit to 4: +$pdf->resourceLimit(\Spatie\PdfToImage\Enums\ResourceLimitType::Thread, 4); +``` + ## Issues regarding Ghostscript This package uses Ghostscript through Imagick. For this to work Ghostscripts `gs` command should be accessible from the PHP process. For the PHP CLI process (e.g. Laravel's asynchronous jobs, commands, etc...) this is usually already the case. @@ -164,6 +174,8 @@ If you receive an error with the message `attempt to perform an operation not al ``` +If you are experiencing failures without any error messages, you may need to increase the resource limits for Imagick. This can be done with the `resourceLimit` method. + ## Testing `spatie/pdf-to-image` uses the PEST framework for unit tests. They can be run with the following command: