diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-03-03 11:38:50 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-03-03 11:38:50 +0100 |
commit | bf4a76d54229f702d048387bd4bad87579d087f0 (patch) | |
tree | 7550c652d30cfa72948ea5cc2ed4e6e738645b7a /pdf-as-pdfbox/src/main/java/at/gv/egiz | |
parent | 2e94ff4058d7c1717ca3f3cff1730b2326a0f8fc (diff) | |
download | pdf-as-4-bf4a76d54229f702d048387bd4bad87579d087f0.tar.gz pdf-as-4-bf4a76d54229f702d048387bd4bad87579d087f0.tar.bz2 pdf-as-4-bf4a76d54229f702d048387bd4bad87579d087f0.zip |
fixed image scaling
Diffstat (limited to 'pdf-as-pdfbox/src/main/java/at/gv/egiz')
-rw-r--r-- | pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java | 12 |
1 files changed, 8 insertions, 4 deletions
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) { |