diff --git a/Userland/Utilities/pdf.cpp b/Userland/Utilities/pdf.cpp index e36e7a8fc5..ba9ef2003e 100644 --- a/Userland/Utilities/pdf.cpp +++ b/Userland/Utilities/pdf.cpp @@ -50,6 +50,8 @@ static PDF::PDFErrorOr print_document_info(PDF::Document& document) static PDF::PDFErrorOr> render_page(PDF::Document& document, PDF::Page const& page) { auto page_size = Gfx::IntSize { 800, round_to(800 * page.media_box.height() / page.media_box.width()) }; + if (int rotation_count = (page.rotate / 90) % 4; rotation_count % 2 == 1) + page_size = Gfx::IntSize { round_to(800 * page.media_box.width() / page.media_box.height()), 800 }; auto bitmap = TRY(Gfx::Bitmap::create(Gfx::BitmapFormat::BGRx8888, page_size)); @@ -58,7 +60,7 @@ static PDF::PDFErrorOr> render_page(PDF::Document& do for (auto const& error : errors.error().errors()) warnln("warning: {}", error.message()); } - return bitmap; + return TRY(PDF::Renderer::apply_page_rotation(bitmap, page)); } static PDF::PDFErrorOr> render_page_to_memory(PDF::Document& document, PDF::Page const& page, int repeats)