WP_Image_Editor_Imagick::pdf_load_source() – Load the image produced by Ghostscript.
You appear to be a bot. Output may be restricted
Description
Load the image produced by Ghostscript.
Includes a workaround for a bug in Ghostscript 8.70 that prevents processing of some PDF files when use-cropbox
is set.
Usage
$true|WP_Error = WP_Image_Editor_Imagick::pdf_load_source();
Parameters
Returns
true|WP_Error
Source
File name: wordpress/wp-includes/class-wp-image-editor-imagick.php
Lines:
1 to 24 of 24
protected function pdf_load_source() { $filename = $this->WP_Image_Editor_Imagick::pdf_setup(); if ( is_wp_error( $filename ) ) { return $filename; } try { // 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 ); // Reading image after Imagick instantiation because `setResolution` // only applies correctly before the image is read. $this->image->readImage( $filename ); } catch ( Exception $e ) { // Attempt to run `gs` without the `use-cropbox` option. See #48853. $this->image->setOption( 'pdf:use-cropbox', false ); $this->image->readImage( $filename ); } return true; }