diff options
author | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2020-11-20 07:48:18 +0100 |
---|---|---|
committer | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2020-11-20 07:48:18 +0100 |
commit | 0923276e0184164ce6ace56383dde59b984d8acf (patch) | |
tree | 1dc54ac709580dbf5af0c594864ca67c8dda7286 /pdf-over-signer | |
parent | 5e6d94b46394a3e0a66abe05d490d20131ae6f4a (diff) | |
parent | 86d77f8df8e831a2794be6a96c005f5eaf5b3016 (diff) | |
download | pdf-over-0923276e0184164ce6ace56383dde59b984d8acf.tar.gz pdf-over-0923276e0184164ce6ace56383dde59b984d8acf.tar.bz2 pdf-over-0923276e0184164ce6ace56383dde59b984d8acf.zip |
merge
Diffstat (limited to 'pdf-over-signer')
10 files changed, 65 insertions, 193 deletions
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.classpath b/pdf-over-signer/pdf-over-sigpdfas4/.classpath deleted file mode 100644 index 6328ed81..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.classpath +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="src" output="target/classes" path="src/main/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="src" output="target/test-classes" path="src/test/java"> - <attributes> - <attribute name="optional" value="true"/> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> - <attributes> - <attribute name="maven.pomderived" value="true"/> - </attributes> - </classpathentry> - <classpathentry kind="output" path="target/classes"/> -</classpath> diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.project b/pdf-over-signer/pdf-over-sigpdfas4/.project deleted file mode 100644 index 1d14e32f..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.project +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>pdf-over-sigpdfas</name> - <comment></comment> - <projects> - <project>pdf-as-common</project> - <project>pdf-as-lib</project> - <project>sigs-pades</project> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - </natures> -</projectDescription> diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 29abf999..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/<project>=UTF-8 diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 51f690b3..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,90 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled -org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,LOW -org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,NOTE diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 05288cb4..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright 2012 by A-SIT, Secure Information Technology Center Austria\n *\n * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by\n * the European Commission - subsequent versions of the EUPL (the "Licence");\n * You may not use this work except in compliance with the Licence.\n * You may obtain a copy of the Licence at\:\n * http\://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an "AS IS" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the Licence for the specific language governing permissions and\n * limitations under the Licence.\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * \n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n// Imports\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="false" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">/**\n * SLF4J Logger instance\n **/\nprivate static final Logger log \= LoggerFactory.getLogger(${type_name}.class);\n\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 62e91186..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Thu Aug 02 12:33:52 CEST 2012 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs deleted file mode 100644 index c6aa7359..00000000 --- a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Fri Aug 03 18:56:31 CEST 2012 -eclipse.preferences.version=1 -project.repository.kind=jira -project.repository.url=http\://jira.egovlabs.gv.at diff --git a/pdf-over-signer/pdf-over-sigpdfas4/pom.xml b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml index 32fea408..04538aea 100644 --- a/pdf-over-signer/pdf-over-sigpdfas4/pom.xml +++ b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml @@ -10,7 +10,7 @@ <name>PDF-Over PDF-AS 4 Signer</name>
<properties>
<project.maindir>${project.basedir}/../..</project.maindir>
- <pdf-as.version>4.1.6-RC</pdf-as.version>
+ <pdf-as.version>4.1.6</pdf-as.version>
</properties>
<dependencies>
<dependency>
@@ -53,6 +53,12 @@ <artifactId>iaik_eccelerate_cms</artifactId>
<version>3.01</version>
</dependency>
+ <dependency>
+ <groupId>at.a-sit</groupId>
+ <artifactId>pdf-over-commons</artifactId>
+ <version>4.2.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<repositories>
<repository>
@@ -61,11 +67,6 @@ <url>https://apps.egiz.gv.at/maven/</url>
</repository>
<repository>
- <id>pdf-as-4-rc</id>
- <name>PDF-AS 4 Repository RC</name>
- <url>https://apps.egiz.gv.at/releases/pdf-as/release/4.1.6RC/mvn-repo/releases/</url>
- </repository>
- <repository>
<id>local-repo</id>
<url>file://${project.maindir}/repo</url>
</repository>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java index 679e1e0e..08722617 100644 --- a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java +++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java @@ -26,6 +26,7 @@ import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import at.asit.pdfover.signator.SignatureDimension; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; @@ -33,13 +34,12 @@ 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.SignParameter; +import at.asit.pdfover.commons.Profile; /** * Implementation of SignatureParameter for PDF-AS 4 Library */ public class PdfAs4SignatureParameter extends SignatureParameter { - /** The base profile ID */ - private static final String PROFILE_ID_BASE = "SIGNATURBLOCK_SMALL"; /** The profile ID extension for the German signature block */ private static final String PROFILE_ID_LANG_DE = "_DE"; /** The profile ID extension for the English signature block */ @@ -48,7 +48,9 @@ public class PdfAs4SignatureParameter extends SignatureParameter { private static final String PROFILE_ID_NOTE = "_NOTE"; /** The profile ID extension for PDF/A compatibility */ private static final String PROFILE_ID_PDFA = "_PDFA"; - + + private static final String PROFILE_ID_RECOMMENDED = "_RECOMMENDED"; + /** * Visibility of signature block */ @@ -57,7 +59,7 @@ public class PdfAs4SignatureParameter extends SignatureParameter { private HashMap<String, String> genericProperties = new HashMap<String, String>(); /** - * This parameters are defining the signature block size + * This parameters are defining the signature block size */ private int sig_w = 229; private int sig_h = 77; @@ -67,6 +69,7 @@ public class PdfAs4SignatureParameter extends SignatureParameter { **/ static final Logger log = LoggerFactory .getLogger(PdfAs4SignatureParameter.class); + private String profile; /* (non-Javadoc) * @see at.asit.pdfover.signator.SignatureParameter#getPlaceholderDimension() @@ -129,7 +132,7 @@ public class PdfAs4SignatureParameter extends SignatureParameter { /** * Gets the Signature Position String for PDF-AS - * + * * @return Signature Position String */ public String getPdfAsSignaturePosition() { @@ -163,21 +166,28 @@ public class PdfAs4SignatureParameter extends SignatureParameter { String lang = getSignatureLanguage(); boolean useNote = (getProperty("SIG_NOTE") != null); boolean usePdfACompat = (getSignaturePdfACompat()); - + //Add Signature Param here// String profileId; - - - - if (PROFILE_VISIBILITY) - { - profileId = PROFILE_ID_BASE; - profileId += (lang != null && lang.equals("en")) ? - PROFILE_ID_LANG_EN : PROFILE_ID_LANG_DE;} - - else - { - profileId ="INVISIBLE"; + + if (!PROFILE_VISIBILITY){ + log.debug("Profile visibility was set to false"); + return Profile.INVISIBLE.name(); + } + + switch (Profile.getProfile(this.profile)){ + case BASE_LOGO: + case INVISIBLE: + return getProfileName(); + case AMTSSIGNATURBLOCK: + profileId = getProfileName(); + profileId += getLangProfilePart(lang); + profileId += PROFILE_ID_RECOMMENDED; + return profileId; + default: + profileId = getProfileName(); + profileId += getLangProfilePart(lang); + break; } if (useNote) @@ -186,7 +196,30 @@ public class PdfAs4SignatureParameter extends SignatureParameter { if (usePdfACompat) profileId += PROFILE_ID_PDFA; - log.debug("Profile ID: " + profileId); + log.debug("Profile ID: {}", profileId); + System.out.println(profileId); return profileId; } + + private String getProfileName(){ + return Profile.getProfile(this.profile).name(); + } + + private String getLangProfilePart(String lang){ + return (lang != null && lang.equals("en")) ? PROFILE_ID_LANG_EN : PROFILE_ID_LANG_DE; + } + + @Override + public void setSignatureProfile(String profile) { + this.profile = profile; + } + + @Override + public String getSignatureProfile() { + return this.profile; + } + } + + + diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java index c2bdfa79..a1934cb2 100644 --- a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java +++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java @@ -5,6 +5,7 @@ import java.util.UUID; import javax.activation.DataSource; +import at.asit.pdfover.commons.Profile; import at.asit.pdfover.signator.ByteArrayDocumentSource; import at.asit.pdfover.signator.SignResult; import at.asit.pdfover.signator.SignResultImpl; @@ -90,6 +91,8 @@ public class PdfAs4Signer implements Signer { param.getConfiguration().setValue(IConfigurationConstants.PLACEHOLDER_MODE, "3"); param.getConfiguration().setValue(IConfigurationConstants.PLACEHOLDER_SEARCH_ENABLED, IConfigurationConstants.TRUE); } + + @@ -144,6 +147,8 @@ public class PdfAs4Signer implements Signer { sp = new SignaturePosition(); else if (tp.isPauto()) sp = new SignaturePosition(tp.getPosX(), tp.getPosY()); + else if (param.getSignatureProfileId().contains(Profile.AMTSSIGNATURBLOCK.getName())) + sp = new SignaturePosition(); else sp = new SignaturePosition(tp.getPosX(), tp.getPosY(), tp.getPage()); result.setSignaturePosition(sp); @@ -151,9 +156,7 @@ public class PdfAs4Signer implements Signer { result.setSignedDocument(new ByteArrayDocumentSource(sstate.getOutput().toByteArray())); return result; - } catch (PdfAsException e) { - throw new SignatureException(e); - } catch (PDFASError e) { + } catch (PdfAsException | PDFASError e) { throw new SignatureException(e); } } |