summaryrefslogtreecommitdiff
path: root/pdf-over-signer/pdf-over-sigpdfas4
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2014-12-12 13:48:28 +0100
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2014-12-12 13:48:28 +0100
commit683f42f194a30e70d4d09f4bac779d15526e1436 (patch)
tree44e74d6f290a623af9a21c06fad02a9847774ec4 /pdf-over-signer/pdf-over-sigpdfas4
parentb1d832da0a2b9da58d94c529ab8d0e4aabcb4c0b (diff)
downloadmocca-683f42f194a30e70d4d09f4bac779d15526e1436.tar.gz
mocca-683f42f194a30e70d4d09f4bac779d15526e1436.tar.bz2
mocca-683f42f194a30e70d4d09f4bac779d15526e1436.zip
Make PDF/A compatibility configurable
Diffstat (limited to 'pdf-over-signer/pdf-over-sigpdfas4')
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java33
1 files changed, 22 insertions, 11 deletions
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 38aabadd..0403de2f 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
@@ -38,14 +38,16 @@ import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
* Implementation of SignatureParameter for PDF-AS 4 Library
*/
public class PdfAs4SignatureParameter extends SignatureParameter {
- /** The profile ID for the German signature block */
- private static final String PROFILE_ID_DE = "SIGNATURBLOCK_SMALL_DE_PDFA";
- /** The profile ID for the German signature block if a signature note is set */
- private static final String PROFILE_ID_DE_NOTE = "SIGNATURBLOCK_SMALL_DE_NOTE_PDFA";
- /** The profile ID for the English signature block */
- private static final String PROFILE_ID_EN = "SIGNATURBLOCK_SMALL_EN_PDFA";
- /** The profile ID for the English signature block if a signature note is set */
- private static final String PROFILE_ID_EN_NOTE = "SIGNATURBLOCK_SMALL_EN_NOTE_PDFA";
+ /** 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 */
+ private static final String PROFILE_ID_LANG_EN = "_EN";
+ /** The profile ID extension for the signature note */
+ 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 HashMap<String, String> genericProperties = new HashMap<String, String>();
@@ -152,10 +154,19 @@ public class PdfAs4SignatureParameter extends SignatureParameter {
public String getPdfAsSignatureProfileId() {
String lang = getSignatureLanguage();
boolean useNote = (getProperty("SIG_NOTE") != null);
+ boolean usePdfACompat = (getSignaturePdfACompat());
- if (lang != null && lang.equals("en"))
- return useNote ? PROFILE_ID_EN_NOTE : PROFILE_ID_EN;
+ String profileId = PROFILE_ID_BASE;
+ profileId += (lang != null && lang.equals("en")) ?
+ PROFILE_ID_LANG_EN : PROFILE_ID_LANG_DE;
- return useNote ? PROFILE_ID_DE_NOTE : PROFILE_ID_DE;
+ if (useNote)
+ profileId += PROFILE_ID_NOTE;
+
+ if (usePdfACompat)
+ profileId += PROFILE_ID_PDFA;
+
+ log.debug("Profile ID: " + profileId);
+ return profileId;
}
}