diff options
2 files changed, 26 insertions, 14 deletions
diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java index d613232f..e05a8ad5 100644 --- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java @@ -34,17 +34,6 @@ public class PDFASSigner implements Signer { static final Logger log = LoggerFactory.getLogger(PDFASSigner.class); /** - * The profile ID - */ - protected static final String PROFILE_ID = "SIGNATURBLOCK_SMALL_DE"; - - /** - * The profile ID - * if a signature note is set - */ - protected static final String PROFILE_NOTE_ID = "SIGNATURBLOCK_SMALL_DE_NOTE"; - - /** * The template URL */ protected static final String URL_TEMPLATE = "http://pdfover.4.gv.at/template"; @@ -83,7 +72,8 @@ public class PDFASSigner implements Signer { // params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILETEST); } params.setSignatureType(Constants.SIGNATURE_TYPE_BINARY); - params.setSignatureProfileId(PROFILE_ID); + + params.setSignatureProfileId(sign_para.getSignatureProfileID()); params.setOutput(new ByteArrayDataSink()); if (parameter.getEmblem() != null) { @@ -93,7 +83,6 @@ public class PDFASSigner implements Signer { if(parameter.getProperty("SIG_NOTE") != null) { params.setProfileOverrideValue("SIG_NOTE", parameter.getProperty("SIG_NOTE")); - params.setSignatureProfileId(PROFILE_NOTE_ID); } // Prepare Output sink diff --git a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 899fa890..43916d08 100644 --- a/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -55,6 +55,15 @@ public class PdfAsSignatureParameter extends SignatureParameter { static final Logger log = LoggerFactory .getLogger(PdfAsSignatureParameter.class); + /** The profile ID for the german signature block */ + private static final String PROFILE_ID_DE = "SIGNATURBLOCK_SMALL_DE"; + /** 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"; + /** The profile ID for the english signature block */ + private static final String PROFILE_ID_EN = "SIGNATURBLOCK_SMALL_EN"; + /** 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"; + private static final int PLACEHOLDER_SCALE = 4; private HashMap<String, String> genericProperties = new HashMap<String, String>(); @@ -117,6 +126,20 @@ public class PdfAsSignatureParameter extends SignatureParameter { return new SignatureDimension(276, 95); } + /** + * Get the Signature Profile ID for this set of parameters + * @return the Signature Profile ID + */ + public String getSignatureProfileID() { + String lang = getSignatureLanguage(); + boolean useNote = (getProperty("SIG_NOTE") != null); + + if (lang != null && lang.equals("en")) + return useNote ? PROFILE_ID_EN_NOTE : PROFILE_ID_EN; + + return useNote ? PROFILE_ID_DE_NOTE : PROFILE_ID_DE; + } + /* * (non-Javadoc) * @@ -129,7 +152,7 @@ public class PdfAsSignatureParameter extends SignatureParameter { PDFASHelper.getPdfAs(); SignatureObject sign_obj = at.knowcenter.wag.egov.egiz.PdfAS - .createSignatureObjectFromType(PDFASSigner.PROFILE_ID); + .createSignatureObjectFromType(getSignatureProfileID()); sign_obj.fillValues(' ', true, false); sign_obj.setKZ(BinarySignator_1_1_0.MY_ID); |