aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java8
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java22
3 files changed, 28 insertions, 4 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index ed7033eb..c40704b1 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -89,7 +89,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
String signatureProfile = parameter.getSignatureProfileId();
if (signatureProfile != null) {
- if (!settings.hasPrefix("sig_obj." + signatureProfile + ".key")) {
+ if (!settings.hasPrefix("sig_obj." + signatureProfile)) {
throw new PdfAsValidationException("error.pdf.sig.09",
signatureProfile);
}
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 39fe164c..82116474 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
@@ -28,6 +28,7 @@ import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg;
+import org.apache.pdfbox.pdmodel.graphics.xobject.PDPixelMap;
import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm;
import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage;
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary;
@@ -42,6 +43,7 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.settings.ISettings;
+import at.gv.egiz.pdfas.common.utils.ImageUtils;
import at.knowcenter.wag.egov.egiz.table.Entry;
import at.knowcenter.wag.egov.egiz.table.Style;
@@ -383,8 +385,14 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder {
.getWidth();
}
}
+
+ if(img.getAlphaRaster() == null && img.getColorModel().hasAlpha()) {
+ img = ImageUtils.removeAlphaChannel(img);
+ }
PDXObjectImage pdImage = new PDJpeg(template, img);
+
+
ImageObject image = new ImageObject(pdImage, size);
images.put(img_ref, image);
innerFormResources.addXObject(pdImage, "Im");
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 c6d515f9..e76c849e 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
@@ -80,20 +80,36 @@ public class PDFBoxTable {
}
if (style == null) {
- throw new IOException("Failed to determine Table style");
+ throw new IOException("Failed to determine Table style, for table " + abstractTable.getName());
}
String fontString = style.getFont();
String vfontString = style.getValueFont();
+
+ if(fontString == null || vfontString == null) {
+
+ }
+
if (parent != null && style == parent.style) {
font = parent.getFont();
valueFont = parent.getValueFont();
} else {
-
+ if(fontString == null && parent != null && parent.style != null) {
+ fontString = parent.style.getFont();
+ } else if(fontString == null) {
+ throw new IOException("Failed to determine Table font style, for table " + abstractTable.getName());
+ }
+
font = new PDFBoxFont(fontString, settings);
-
+
+ if(vfontString == null && parent != null && parent.style != null) {
+ vfontString = parent.style.getValueFont();
+ } else if(fontString == null) {
+ throw new IOException("Failed to determine value Table font style, for table " + abstractTable.getName());
+ }
+
valueFont = new PDFBoxFont(vfontString, settings);
}
padding = style.getPadding();