Reinstate 300dpi export option Pressbooks 4.0+

Greetings:

I know the option to force 300dpi was removed per https://github.com/pressbooks/pressbooks/issues/744

We have many books where images were set for 300dpi. Now they are reduced to 96 and ‘physically’ do not layout properly within the books. I can provide examples or screen shots from our publisher/editor if you need. We need 300dpi for our Prince PDF book versions.

Basically, we have to re-edit and re-publish many of our existing books. From our publisher/editor:
“if you change the sizes of the images using the edit image option on the site, it downsamples it so that it exports at really low resolution. I have to let everything be “full size” but then when I export it to PDF, since I can’t force the 300dpi, they get too big and cause awkward gaps and still have low resolution”

Could the “force 300dpi” functionality be re-instated somehow? I have written and tweaked plugins; is there a way to make this a must-use plugin (for our instance of Pressbooks at least :slight_smile: ? Thanks.

Hi @rootl, adding the following in the form of a must-use plugin should override the new setting for both old and new themes:

add_filter( 'pb_pdf_css_override', function( $scss ) {
  $scss .= '$prince-image-resolution: 300dpi;' . "\n" . 'img { prince-image-resolution: 300dpi; }';
  return $scss;
} );

Let me know if it works! If not I will help figure it out one way or another.

1 Like