Uses
| Uses | Description |
|---|---|
| wp-includes/class-wp-error.php: WP_Error::__construct() | Initialize the error. |
Sets up Imagick for PDF processing.
Increases rendering DPI and only loads first page.
File: wp-includes/class-wp-image-editor-imagick.php
protected function pdf_setup() {
try {
// By default, PDFs are rendered in a very low resolution.
// We want the thumbnail to be readable, so increase the rendering DPI.
$this->image->setResolution( 128, 128 );
// When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped
// area (resulting in unnecessary whitespace) unless the following option is set.
$this->image->setOption( 'pdf:use-cropbox', true );
// Only load the first page.
return $this->file . '[0]';
} catch ( Exception $e ) {
return new WP_Error( 'pdf_setup_failed', $e->getMessage(), $this->file );
}
} | Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_image_editor_imagick/pdf_setup