aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle2
-rw-r--r--pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java18
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java3
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java2
-rw-r--r--pdf-as-lib/src/main/resources/config/config.zipbin1276569 -> 1276510 bytes
-rw-r--r--pdf-as-lib/src/main/resources/icm/sRGB Color Space Profile.icmbin0 -> 3144 bytes
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java11
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java7
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java1
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFUtilities.java21
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java2
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java9
12 files changed, 51 insertions, 25 deletions
diff --git a/build.gradle b/build.gradle
index c3c2ae2d..9ae665d3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -16,7 +16,7 @@ task wrapper(type: Wrapper) {
allprojects {
apply plugin: 'com.github.ben-manes.versions'
repositories { mavenCentral() }
- version = '4.2.0-Snapshot'
+ version = '4.1.5-SNAPSHOT'
}
configurations {
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
index a5dff854..f384a140 100644
--- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
+++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java
@@ -46,6 +46,10 @@ import org.slf4j.Logger;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.utils.StreamUtils;
+import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
+import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner;
import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
import at.gv.egiz.pdfas.lib.api.sign.SignResult;
@@ -56,7 +60,18 @@ import at.gv.egiz.pdfas.moa.MOAConnector;
import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
import at.gv.egiz.pdfas.sigs.pades.PAdESSignerKeystore;
import at.gv.egiz.sl.util.BKUSLConnector;
+import org.apache.commons.cli.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.activation.DataSource;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.UUID;
public class Main {
@@ -583,3 +598,6 @@ public class Main {
}
}
}
+
+
+
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
index fb19347a..bb6cca83 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/settings/SignatureProfileSettings.java
@@ -57,8 +57,7 @@ public class SignatureProfileSettings implements IProfileConstants {
logger.debug("Table Prefix: " + tablePrefix);
Map<String, String> keys = configuration.getValuesPrefix(keysPrefix);
- Map<String, String> values = configuration
- .getValuesPrefix(valuesPrefix);
+ Map<String, String> values = configuration.getValuesPrefix(valuesPrefix);
if (keys != null) {
Iterator<String> keyIterator = keys.keySet().iterator();
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
index a921bcd3..a9b8bb2f 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
@@ -53,7 +53,7 @@ public interface IConfigurationConstants {
public static final String DEFAULT_SIGNATURE_PROFILE = SIG_OBJECT + SEPERATOR + TYPE + SEPERATOR + DEFAULT;
public static final String CONFIG_BKU_URL = "bku.sign.url";
-
+
/**
* MOA SS Signing Key Identifier
*/
diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip
index 17fe5c6b..84770c37 100644
--- a/pdf-as-lib/src/main/resources/config/config.zip
+++ b/pdf-as-lib/src/main/resources/config/config.zip
Binary files differ
diff --git a/pdf-as-lib/src/main/resources/icm/sRGB Color Space Profile.icm b/pdf-as-lib/src/main/resources/icm/sRGB Color Space Profile.icm
new file mode 100644
index 00000000..7f9d18d0
--- /dev/null
+++ b/pdf-as-lib/src/main/resources/icm/sRGB Color Space Profile.icm
Binary files differ
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
index 1a51b4db..534c6c40 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java
@@ -171,22 +171,17 @@ public class Positioning {
page = pos.getPage();
// System.out.println("XXXXPAGE="+page+" doc_pages="+doc_pages);
- if (page > doc_pages && page!=1) {
+ if (page > doc_pages) {
make_new_page = true;
page = doc_pages;
- // throw new PDFDocumentException(227, "Page number is to big(="
- // + page+
- // ") cannot be parsed.");
- }
- if (page < doc_pages && page!=1) {
- page = page - 1;
}
}
+
+
PDPage pdPage = pdfDataSource.getPage(page-1);
- //PDPage pdPage = pdfDataSource.getPages().get(page);
PDRectangle cropBox = pdPage.getCropBox();
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index 5db09ea1..3cb103a7 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -132,7 +132,6 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
COSDocument visualSignatureDocumentGuard = null;
try {
-
doc = pdfObject.getDocument();
SignaturePlaceholderData signaturePlaceholderData = PlaceholderFilter
@@ -359,7 +358,9 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
COSBase base = root.getCOSObject().getItem(COSName.OUTPUT_INTENTS);
InputStream colorProfile = null;
- colorProfile = this.getClass().getResourceAsStream("/icm/sRGB.icm");
+ //colorProfile = this.getClass().getResourceAsStream("/icm/sRGB.icm");
+ colorProfile = this.getClass().getResourceAsStream("/icm/sRGB Color Space Profile.icm");
+
//Set output intents for PDF/A conformity//
try {
PDOutputIntent intent = new PDOutputIntent(doc, colorProfile);
@@ -382,7 +383,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
IOUtils.closeQuietly(colorProfile);
}
}
- options.setPage(positioningInstruction.getPage());
+ options.setPage(positioningInstruction.getPage()-1);
options.setVisualSignature(properties.getVisibleSignature());
}
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
index bb692f06..bc634dc5 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
@@ -85,7 +85,6 @@ public class PDFBoxTable {
case Entry.TYPE_CAPTION:
case Entry.TYPE_VALUE:
String value = (String) cell.getValue();
-
//Check if the used value font supports all characters in string
PDFont f = null;
try{
diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFUtilities.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFUtilities.java
index 08ef64b7..995b4e10 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFUtilities.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFUtilities.java
@@ -89,17 +89,22 @@ public abstract class PDFUtilities implements IConfigurationConstants{
int yCoord = bim.getHeight() - 1 - (int)footer_line;
- for(int row = yCoord; row >= 0; row--){
- for(int col = 0; col < bim.getWidth(); col++){
- int val = bim.getRGB(col, row);
- if(val != bgColor.getRGB()){
- yCoord = row;
- row=-1;
- break;
+ for(int row = yCoord; row >= 0; row--)
+ {
+ if (row == 0)
+ yCoord = row;
+ else
+ {
+ for(int col = 0; col < bim.getWidth(); col++){
+ int val = bim.getRGB(col, row);
+ if(val != bgColor.getRGB()){
+ yCoord = row;
+ row=-1;
+ break;
+ }
}
}
}
-
String outFile = settings.getValue(SIG_PLACEMENT_DEBUG_OUTPUT);
if(outFile!=null){
ImageIOUtil.writeImage(bim, outFile, 72);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
index 6d9be34c..1fffb17d 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/config/WebConfiguration.java
@@ -630,7 +630,7 @@ public class WebConfiguration implements IConfigurationConstants {
}
return ivalue;
}
-
+
public static String getSL20KeyStorePath() {
return properties.getProperty(SL20_KEYSTORE_FILE);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
index a8d3b1a2..ec7e7f2b 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java
@@ -40,6 +40,15 @@ import at.gv.egiz.pdfas.web.helper.PdfAsParameterExtractor;
import at.gv.egiz.pdfas.web.stats.StatisticEvent;
import at.gv.egiz.pdfas.web.stats.StatisticEvent.Status;
import at.gv.egiz.pdfas.web.stats.StatisticFrontend;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* Servlet implementation class PDFData