Image orientation not respected when exporting to PDF #4493

Open
opened 2026-02-05 09:00:04 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @TylerJMcLean on GitHub (Feb 27, 2024).

Describe the Bug

Similar to #1854 I believe that the orientation data for the image is not being respected when exporting to PDF. Since the fix was applied, my images show up in the correct orientation on Bookstack itself. But when I export, it reverts to the previous behaviour of ignoring the rotation

In bookstack
bookstack_i1

Export to PDF
bookstack_i2

Steps to Reproduce

  1. Create a document with an image in Bookstack
  2. Save the document
  3. Export to PDF
  4. Open PDF

Expected Behaviour

Image should have the same orientation as shown on the site

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v23.12.3

Originally created by @TylerJMcLean on GitHub (Feb 27, 2024). ### Describe the Bug Similar to #1854 I believe that the orientation data for the image is not being respected when exporting to PDF. Since the fix was applied, my images show up in the correct orientation on Bookstack itself. But when I export, it reverts to the previous behaviour of ignoring the rotation In bookstack ![bookstack_i1](https://github.com/BookStackApp/BookStack/assets/52714460/82daa846-539d-453b-b937-b48f3db26d8c) Export to PDF ![bookstack_i2](https://github.com/BookStackApp/BookStack/assets/52714460/623bd45e-ff68-466f-806f-189faf31a0ad) ### Steps to Reproduce 1. Create a document with an image in Bookstack 2. Save the document 3. Export to PDF 4. Open PDF ### Expected Behaviour Image should have the same orientation as shown on the site ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v23.12.3
OVERLORD added the 🐛 Bug🏭 Back-End Upstream labels 2026-02-05 09:00:04 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 27, 2024):

Thanks for reporting @TylerJMcLean,
Will be related to the upstream issue here: https://github.com/dompdf/dompdf/issues/2456

As a workaround, if needed, you could rotate the image via an image editing app (GIMP, Photopea etc...) so that the image itself is fully orientated (Rather than orientated via EXIF metadata).

@ssddanbrown commented on GitHub (Feb 27, 2024): Thanks for reporting @TylerJMcLean, Will be related to the upstream issue here: https://github.com/dompdf/dompdf/issues/2456 As a workaround, if needed, you could rotate the image via an image editing app (GIMP, Photopea etc...) so that the image itself is fully orientated (Rather than orientated via EXIF metadata).
Author
Owner

@TylerJMcLean commented on GitHub (Feb 28, 2024):

Thanks @ssddanbrown for the quick response. I will do that until this is fixed.

As a side thought, it's pretty weird that some phones save it that way even when taken in portrait orientation.

  • Tyler
@TylerJMcLean commented on GitHub (Feb 28, 2024): Thanks @ssddanbrown for the quick response. I will do that until this is fixed. As a side thought, it's pretty weird that some phones save it that way even when taken in portrait orientation. - Tyler
Author
Owner

@abdulmannans commented on GitHub (Jan 16, 2025):

Is there any solution to this?

@abdulmannans commented on GitHub (Jan 16, 2025): Is there any solution to this?
Author
Owner

@virtadpt commented on GitHub (Jan 16, 2025):

@TylerJMcLean Here's the weird thing: This happens even when the phone that took the picture doesn't put an EXIF tag that causes the image to be rotated. I've got a Samsung Galaxy S23 which doesn't do that (I checked with exiftools), but whenever I take a picture with my phone and add it to a wiki page it's always rotated. Most of the time it's only slightly amusing, but I'm uploading photographs of recipes I'm archiving and it's a huge pain in the butt when it comes to transcribing the text.

@virtadpt commented on GitHub (Jan 16, 2025): @TylerJMcLean Here's the weird thing: This happens even when the phone that took the picture doesn't put an EXIF tag that causes the image to be rotated. I've got a Samsung Galaxy S23 which doesn't do that (I checked with exiftools), but whenever I take a picture with my phone and add it to a wiki page it's always rotated. Most of the time it's only slightly amusing, but I'm uploading photographs of recipes I'm archiving and it's a huge pain in the butt when it comes to transcribing the text.
Author
Owner

@ssddanbrown commented on GitHub (Jan 16, 2025):

Just to throw out some other options to work around this:

@ssddanbrown commented on GitHub (Jan 16, 2025): Just to throw out some other options to work around this: - Export via the browser's print to PDF feature. - You could [set a command to use an alternative renderer](https://www.bookstackapp.com/docs/admin/pdf-rendering/#pdf-export-command) which may have better support for image orientations.
Author
Owner

@ssddanbrown commented on GitHub (Feb 1, 2025):

If you've been seeing rotated images outside of just PDF exports (in gallery and in content) then this may have been due to some changes in v24.05 which have been addressed in https://github.com/BookStackApp/BookStack/issues/5462.

@ssddanbrown commented on GitHub (Feb 1, 2025): If you've been seeing rotated images outside of just PDF exports (in gallery and in content) then this may have been due to some changes in v24.05 which have been addressed in https://github.com/BookStackApp/BookStack/issues/5462.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4493