diff options
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/pdf/IncrementalUpdateInformation.java | 53 |
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;
+ }
}
|