diff --git a/application/src/File/Thumbnailer/ImageMagick.php b/application/src/File/Thumbnailer/ImageMagick.php index 2456c8bc93..4caa6c056a 100644 --- a/application/src/File/Thumbnailer/ImageMagick.php +++ b/application/src/File/Thumbnailer/ImageMagick.php @@ -83,6 +83,9 @@ public function create($strategy, $constraint, array $options = []) $commandArgs = [$this->convertPath]; if ($mediaType == 'application/pdf') { $commandArgs[] = '-density 150'; + if ($this->getOption('pdfUseCropBox', true)) { + $commandArgs[] = '-define pdf:use-cropbox=true'; + } } $commandArgs[] = escapeshellarg($origPath); $commandArgs = array_merge($commandArgs, $args); diff --git a/application/src/File/Thumbnailer/Imagick.php b/application/src/File/Thumbnailer/Imagick.php index 3598ff2d9c..1a0829c63b 100644 --- a/application/src/File/Thumbnailer/Imagick.php +++ b/application/src/File/Thumbnailer/Imagick.php @@ -39,6 +39,9 @@ public function create($strategy, $constraint, array $options = []) $imagick = new ImagickPhp; if ($mediaType == 'application/pdf') { $imagick->setResolution(150, 150); + if ($this->getOption('pdfUseCropBox', true)) { + $imagick->setOption('pdf:use-cropbox', true); + } } $imagick->readImage($origPath); } catch (ImagickException $e) {