aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java10
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java11
2 files changed, 19 insertions, 2 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 e24ff939..ea26c778 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
@@ -369,10 +369,16 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder {
float width = colsSizes[j];
- int size = (int) Math.floor((double) width);
+ float size = (int) Math.floor((double) width);
size -= 2 * padding;
logger.debug("Scaling image to: " + size);
-
+
+ if(table.style != null) {
+ if(table.style.getImageScaleToFit() != null) {
+ size = table.style.getImageScaleToFit().getWidth();
+ }
+ }
+
PDXObjectImage pdImage = new PDJpeg(template, img);
ImageObject image = new ImageObject(pdImage, size);
images.put(img_ref, image);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
index 7274cdf2..1c9ad953 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
@@ -251,6 +251,9 @@ public class PDFBoxTable {
return c.getStringWidth(string) / 1000 * fontSize;
}
case Entry.TYPE_IMAGE:
+ if(style != null && style.getImageScaleToFit() != null) {
+ return style.getImageScaleToFit().getWidth();
+ }
return 80.f;
case Entry.TYPE_TABLE:
PDFBoxTable pdfBoxTable = null;
@@ -387,6 +390,11 @@ public class PDFBoxTable {
cell.setValue(concatLines(lines));
return fheight * lines.length;
case Entry.TYPE_IMAGE:
+ if(style != null && style.getImageScaleToFit() != null) {
+ if( style.getImageScaleToFit().getHeight() < width) {
+ return style.getImageScaleToFit().getHeight();
+ }
+ }
return width;
case Entry.TYPE_TABLE:
PDFBoxTable pdfBoxTable = null;
@@ -437,6 +445,9 @@ public class PDFBoxTable {
return fheight;
}
case Entry.TYPE_IMAGE:
+ if(style != null && style.getImageScaleToFit() != null) {
+ return style.getImageScaleToFit().getHeight();
+ }
return 80.f;
case Entry.TYPE_TABLE:
PDFBoxTable pdfBoxTable = null;