aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-06 10:07:34 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-06 10:07:34 +0200
commitcd45da1f83fa5682347e422910dbad8ce4392e69 (patch)
treea1d69cc7760c981476cb0170cbcc5075e7b74cf6 /pdf-as-lib/src/main/java/at/gv/egiz
parentbb34e8aa6d4efd07a951cc519fdee68a6d787519 (diff)
downloadpdf-as-4-cd45da1f83fa5682347e422910dbad8ce4392e69.tar.gz
pdf-as-4-cd45da1f83fa5682347e422910dbad8ce4392e69.tar.bz2
pdf-as-4-cd45da1f83fa5682347e422910dbad8ce4392e69.zip
scaling image to keep aspect ratio
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java
index e8d1f4c0..00e7e149 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java
@@ -589,6 +589,15 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder {
float origWidth = (float) img.getWidth();
float origHeight = (float) img.getHeight();
+ if (table.style != null) {
+ if (table.style.getImageScaleToFit() != null) {
+ iwidth = table.style.getImageScaleToFit()
+ .getWidth();
+ iheight = table.style.getImageScaleToFit()
+ .getHeight();
+ }
+ }
+
float wfactor = iwidth / origWidth;
float hfactor = iheight / origHeight;
float scaleFactor = wfactor;
@@ -600,16 +609,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder {
.floor((double) (scaleFactor * origWidth));
iheight = (float) Math
.floor((double) (scaleFactor * origHeight));
-
- if (table.style != null) {
- if (table.style.getImageScaleToFit() != null) {
- iwidth = table.style.getImageScaleToFit()
- .getWidth();
- iheight = table.style.getImageScaleToFit()
- .getHeight();
- }
- }
-
+
logger.debug("Scaling image to: " + iwidth + " x "
+ iheight);