diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-05-15 12:46:16 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-05-15 12:46:16 +0200 |
commit | 89679faa47dcab8d4ad73c49038f233665f6d44b (patch) | |
tree | d3a9d6ef4888f307b6e257a341018c19d45b56be /pdf-as-lib/src/main/java/at/gv | |
parent | 241eeefd4182ce97bc9a9db4031a9b4ffe328ce8 (diff) | |
download | pdf-as-4-89679faa47dcab8d4ad73c49038f233665f6d44b.tar.gz pdf-as-4-89679faa47dcab8d4ad73c49038f233665f6d44b.tar.bz2 pdf-as-4-89679faa47dcab8d4ad73c49038f233665f6d44b.zip |
Fixing GIF inclusion
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv')
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(); |