From bf4a76d54229f702d048387bd4bad87579d087f0 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 3 Mar 2016 11:38:50 +0100 Subject: fixed image scaling --- .../gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'pdf-as-pdfbox/src') diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java index d5c5d683..82d21b0f 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java @@ -549,10 +549,14 @@ public class PDFBoxTable { // } } Dimension dim = ImageUtils.getImageDimensions(imageFile, settings); - if (dim.getHeight() > 80.0f) { - return width + padding * 2; - } - return (float) dim.getHeight() + padding * 2; + float wfactor = (float) ((width - padding * 2.0f) / dim.getWidth()); + float scaleFactor = wfactor; + float iheight = (float) Math + .floor((double) (scaleFactor * dim.getHeight())); + //if (dim.getHeight() > 80.0f) { + // return width + padding * 2; + //} + return (float) iheight + padding * 2; case Entry.TYPE_TABLE: PDFBoxTable pdfBoxTable = null; if (cell.getValue() instanceof Table) { -- cgit v1.2.3