From 95c11be9df0a8b1de53bf39c4d9d2c23ff330fff Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 3 Nov 2010 11:07:33 +0000 Subject: added sructcontent/wai support git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@598 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/pdf/BinarySignature.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java index ec6f567..8ac4b85 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java @@ -18,7 +18,6 @@ package at.knowcenter.wag.egov.egiz.pdf; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; @@ -32,14 +31,12 @@ import java.util.Comparator; import java.util.Iterator; import java.util.List; - import org.apache.commons.lang.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import at.gv.egiz.pdfas.api.timestamp.TimeStamper; import at.gv.egiz.pdfas.exceptions.ErrorCode; -import at.gv.egiz.pdfas.exceptions.framework.CorrectorException; import at.gv.egiz.pdfas.exceptions.pdf.CaptionNotFoundException; import at.gv.egiz.pdfas.exceptions.pdf.KZSettingNotFoundException; import at.gv.egiz.pdfas.framework.input.PdfDataSource; @@ -809,7 +806,7 @@ public abstract class BinarySignature // incremental updated // The stamper allows this by setting append = true boolean adobeSigField = AdobeSignatureHelper.isAdobeSignatureFieldEnabled(so.getSignatureTypeDefinition().getType()); - PdfStamper stamper = null; + PdfStamper stamper = null; if (adobeSigField) { stamper = PdfStamper.createSignature(reader, baos, '\0', null, true); } else { @@ -849,8 +846,15 @@ public abstract class BinarySignature // pdf_table.writeSelectedRows(0, -1, SIGNATURE_BORDER / 2, // table_position, content); - + // exthex + StructContentHelper structHelper = new StructContentHelper(stamper, content, pi.getPage()); + structHelper.buildMainStructData(so, si); + + structHelper.beginSigBlockContent(); + content.addTemplate(table_template, pi.getX(), pi.getY() - pdf_table.getTotalHeight()); + + structHelper.endSigBlockContent(); ActualTablePos atp = new ActualTablePos(); atp.page = pi.getPage(); @@ -902,23 +906,23 @@ public abstract class BinarySignature // PdfObject value = resources.get(key); // System.out.println(" " + key + " = " + value); // } - + // add the EGIZ dict: if (variable_field_definitions != null) { createEgizDict(stamper, table_template, iui, variable_field_definitions, all_field_definitions, invisible_field_definitions, invisibleKZString); } - //stamper.close(); if (adobeSigField) { - AdobeSignatureHelper.createAdobeSignatureField(stamper, si, so, atp); // here..., stamper is closed + AdobeSignatureHelper.createAdobeSignatureField(stamper, si, so, atp, structHelper); // here..., stamper is closed } else { stamper.close(); } // System.out.println("wprinz: STAMPING FINISHED"); // just to make sure the stream is really closed - baos.close(); + baos.close();// + //org.apache.commons.io.FileUtils.writeByteArrayToFile(new java.io.File("C:/out.pdf"), ((at.gv.egiz.pdfas.impl.output.ByteArrayDataSink) written_pdf).getByteArray()); // iui.signed_pdf = baos.toByteArray(); return iui; -- cgit v1.2.3