From eb7766f3265b2732ebd8cc4764fcdec213d68b61 Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Fri, 18 Nov 2022 11:42:48 +0100 Subject: respect PDF rotation --- .../main/java/at/asit/pdfover/gui/composites/SignaturePanel.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java index 250daf7d..afc6b0db 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java @@ -263,10 +263,11 @@ public class SignaturePanel extends JPanel { this.currentImage = null; return; } - + + boolean isRotated = ((currentPage.getRotation()%180) == 90); PDRectangle actualPageSize = currentPage.getBBox(); - this.pageWidth = actualPageSize.getWidth(); - this.pageHeight = actualPageSize.getHeight(); + this.pageWidth = isRotated ? actualPageSize.getHeight() : actualPageSize.getWidth(); + this.pageHeight = isRotated ? actualPageSize.getWidth() : actualPageSize.getHeight(); this.pageToImageScale = getToolkit().getScreenSize().height / this.pageHeight; // get the new image -- cgit v1.2.3