aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-13 13:03:49 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-13 13:03:49 +0000
commit37e150f9369bc72416b3f674cba2e1502ec13adc (patch)
tree3875d56086619de834797caf146600310c6927c2 /src/main/java/at/knowcenter/wag/egov/egiz
parentcc9a121f2e9edf3a2a69594c2a5deded14509f41 (diff)
downloadpdf-as-3-37e150f9369bc72416b3f674cba2e1502ec13adc.tar.gz
pdf-as-3-37e150f9369bc72416b3f674cba2e1502ec13adc.tar.bz2
pdf-as-3-37e150f9369bc72416b3f674cba2e1502ec13adc.zip
timestamp, pdf/version
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@408 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java53
1 files changed, 50 insertions, 3 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java
index 4352847..27c7413 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java
@@ -17,16 +17,20 @@
*/
package at.knowcenter.wag.egov.egiz.pdf;
+import java.io.IOException;
import java.io.Serializable;
import java.util.List;
-import at.gv.egiz.pdfas.framework.input.PdfDataSource;
-import at.gv.egiz.pdfas.framework.output.DataSink;
+import org.apache.log4j.Logger;
+import at.gv.egiz.pdfas.api.timestamp.TimeStamper;
+import at.gv.egiz.pdfas.framework.input.PdfDataSource;
+import at.gv.egiz.pdfas.utils.PdfAUtil;
import at.knowcenter.wag.egov.egiz.sig.SignatureData;
-import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
+import com.lowagie.text.pdf.PdfReader;
+
/**
* This parameter object contains all useful inforamtion the binary incremental
* update methods need to create and replace a binary singature block.
@@ -43,6 +47,8 @@ import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
*/
public class IncrementalUpdateInformation implements Serializable
{
+ public static final Logger log = Logger.getLogger(IncrementalUpdateInformation.class);
+
/**
* SVUID.
*/
@@ -157,6 +163,16 @@ public class IncrementalUpdateInformation implements Serializable
* The length of the /cert placeholder.
*/
public int cert_length = -1;
+
+ /**
+ * The length of the /TimeStamp placeholder.
+ */
+ public int timestamp_length = -1;
+
+ /**
+ * The start of the first /Timestamp
+ */
+ public int timestamp_start = -1;
/**
* The list of strings of the KZ.
@@ -187,4 +203,35 @@ public class IncrementalUpdateInformation implements Serializable
* The invisible KZ String, if KZ is invisible.
*/
public String invisibleKZString = null;
+
+
+ /**
+ * The timestamper if any
+ */
+ public TimeStamper timeStamper;
+
+ // dferbas
+
+ public String getPdfVersion() {
+ byte[] pdf_data = this.original_document.getAsByteArray();
+ PdfReader reader;
+ String pdfVersion = null;
+ try {
+ reader = new PdfReader(pdf_data);
+ // is.close();
+
+ byte[] metaData = reader.getMetadata();
+ if (metaData != null) {
+ pdfVersion = PdfAUtil.findPdfAVersion(new String(metaData));
+ }
+ if (pdfVersion == null) {
+ pdfVersion = "PDF 1." + reader.getPdfVersion();
+ }
+
+ reader.close();
+ } catch (IOException e) {
+ log.error(e.getMessage(), e);
+ }
+ return pdfVersion;
+ }
}