[Improvement]: Add -dUseCropBox option in Ghostscript to generation of thumbnail from pdf (#18317)#18317
Conversation
Review Checklist
|
|
|
Thank you for your PR! |
|
I'm afraid that we can't just change the default to use CropBox instead of MediaBox, because there are also use-cases in Pimcore where you might want MediaBox, e.g. when using the PDF editable: https://docs.pimcore.com/platform/Pimcore/Documents/Editables/PDF/ While I agree, that Cropbox would make sense in certain cases for the preview images in the admin UI (maybe also not for all 🤔) it could lead to bad presentations in many other cases. So actually I'm thinking of making it somehow individually configurable, maybe on the image thumbnail configuration as an advanced option, same as |
|
Agree with Bernie, i am changing base branch to 12.x,adding Improvement label and switch to draft, looking forward to the adaptation to make this cropbox configurable, TIA |
|
Agree, good idea, to add this logic as parameter in thumbnails configuration. |
|
@croitoruion 🏓 Any updates on this? Thank you in advance |
|
@croitoruion any chance to apply the configuration change? TIA |
|
@kingjia90 Sorry, I haven’t had time for that, and I don’t think I’ll be able to in the near future. |
|
All good, thank you for letting me know. If you don't mind, i'll take it over and try to finalize it. |
…pdf-thumbnail-generation # Conflicts: # models/Asset/Image/Thumbnail/Config/Dao.php
…for-pdf-thumbnail-generation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
…for-pdf-thumbnail-generation
|




Changes in this pull request
Resolves #
This PR updates the Ghostscript command used for generating thumbnails from PDFs by adding the -dUseCropBox flag. This ensures that only the visible content area (as defined by the PDF's CropBox) is rendered, avoiding excessive white margins around elements like single images or centered content.
When a PDF page contains only a small image or centered content, the default rendering includes large blank margins, resulting in thumbnails where the actual content appears tiny. (Attaching examples: the generated thumbnail and its usage to clearly demonstrate the issue.)

Additional info
After we set the flag we obtain such image

Attaching also original pdf
osteoporosis_diagram.pdf