Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
patinthehat committed Jun 22, 2024
1 parent 80dad64 commit 662f9de
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -164,6 +174,8 @@ If you receive an error with the message `attempt to perform an operation not al
<policy domain="coder" rights="read | write" pattern="PDF" />
```

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:
Expand Down

0 comments on commit 662f9de

Please sign in to comment.