From 770d0ce12e978f03d58bfb1bb7d77078c97b9129 Mon Sep 17 00:00:00 2001 From: pdanner Date: Wed, 3 Nov 2010 11:05:02 +0000 Subject: added sructcontent/wai support git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@597 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java index aca45f0..deab953 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java @@ -17,7 +17,9 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureObject; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.AcroFields; import com.lowagie.text.pdf.PdfDictionary; +import com.lowagie.text.pdf.PdfFormField; import com.lowagie.text.pdf.PdfName; +import com.lowagie.text.pdf.PdfNumber; import com.lowagie.text.pdf.PdfObject; import com.lowagie.text.pdf.PdfSignature; import com.lowagie.text.pdf.PdfSignatureAppearance; @@ -55,7 +57,7 @@ public class AdobeSignatureHelper { * @throws PresentableException */ public static void createAdobeSignatureField(PdfStamper stamper, SignatorInformation si, - SignatureObject so, ActualTablePos atp) throws PresentableException { + SignatureObject so, ActualTablePos atp, StructContentHelper structHelper) throws PresentableException { try { logger.debug("Creating adobe signature field."); @@ -141,6 +143,14 @@ public class AdobeSignatureHelper { // content element is mandatory but empty HashMap exc = new HashMap(); exc.put(PdfName.CONTENTS, new Integer(2)); + + PdfNumber parentNum = structHelper.buildAnnotStructParent(); + if (parentNum != null) { + PdfFormField sigField = PdfFormField.createSignature(stamper.getWriter()); + sap.setSigFormField(sigField); + sigField.put(PdfName.STRUCTPARENT, parentNum); + structHelper.buildAdobeSigStruct(sigField, finalFieldName); + } sap.preClose(exc); // *2+2 PdfDictionary dic = new PdfDictionary(); @@ -181,7 +191,7 @@ public class AdobeSignatureHelper { return getDefaultableConfigProperty(sigProfile, ADOBE_VERIFY_URL_KEY, "http://www.signaturpruefung.gv.at"); } - private static String getDefaultableConfigProperty(String sigProfile, String propName, String defaultValue) { + public static String getDefaultableConfigProperty(String sigProfile, String propName, String defaultValue) { String confVal; try { confVal = SettingsReader.getInstance().getSetting( -- cgit v1.2.3