---
title: "Discussion on \"Why Phone Photos Turn Sideways in Your jsPDF Output (and a Small Fix)\" | Hashnode"
description: "Discussion on \"Why Phone Photos Turn Sideways in Your jsPDF Output (and a Small Fix)\". You take a portrait photo of a form, drop it into a web app that builds a PDF, and the page comes out rotated 90 degrees. The same photo looks fine in the browser's <img> tag, fine in the gallery app,"
url: "https://hashnode.com/posts/why-phone-photos-turn-sideways-in-your-jspdf-output-and-a-small-fix/6ac6afbe052ee503d6641a06"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why Phone Photos Turn Sideways in Your jsPDF Output (and a Small Fix)](https://jpgtopdfmobile.hashnode.dev/why-phone-photos-turn-sideways-in-your-jspdf-output-and-a-small-fix?utm_source=hashnode&utm_medium=feed)

You take a portrait photo of a form, drop it into a web app that builds a PDF, and the page comes out rotated 90 degrees. The same photo looks fine in the browser's <img> tag, fine in the gallery app,

Oct 7 · 5 min read · jpgtopdfmobile.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#pdf](https://hashnode.com/tag/pdf)
-   [#jspdf](https://hashnode.com/tag/jspdf)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Vikky](https://hashnode.com/@jpgtopdfmobile)

@jpgtopdfmobile

  
[View profile](https://hashnode.com/@jpgtopdfmobile)

Building JPG to PDF Mobile, a free browser-based image to PDF converter that keeps files on your device.

Building JPG to PDF Mobile, a free browser-based image to PDF converter that keeps files on your device. https://jpgtopdfmobile.com/

## Responses 1

Markdown supported · ⌘↵ to post

[Adam Lewis](https://hashnode.com/@nark3d)

[Oct 11](https://hashnode.com/posts/why-phone-photos-turn-sideways-in-your-jspdf-output-and-a-small-fix/6ac6afbe052ee503d6641a06/comment/6acb4e099d64693c6e3bca75)

You get a rotated image with no error to chase because drawImage respects the source orientation but the page transform ignores it. EXIF is input to normalise rather than metadata to preserve: read the tag, bake the rotation into the bitmap or the transform matrix, then let the export forget it ever existed. EXIF-orientation libraries exist for exactly this and they hand you a canvas you can draw straight into jsPDF. The resize and the re-encode tend to drop the tag on the way through, which is why the fix has to happen after the image is decoded rather than before.
