diff options
author | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2014-12-12 13:48:28 +0100 |
---|---|---|
committer | Tobias Kellner <tobias.kellner@iaik.tugraz.at> | 2014-12-12 13:48:28 +0100 |
commit | 683f42f194a30e70d4d09f4bac779d15526e1436 (patch) | |
tree | 44e74d6f290a623af9a21c06fad02a9847774ec4 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils | |
parent | b1d832da0a2b9da58d94c529ab8d0e4aabcb4c0b (diff) | |
download | mocca-683f42f194a30e70d4d09f4bac779d15526e1436.tar.gz mocca-683f42f194a30e70d4d09f4bac779d15526e1436.tar.bz2 mocca-683f42f194a30e70d4d09f4bac779d15526e1436.zip |
Make PDF/A compatibility configurable
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java index 769c477b..a468f0e2 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java @@ -68,19 +68,30 @@ public class SignaturePlaceholderCache { final String sigLangProp = "LANG"; //$NON-NLS-1$ final String sigEmblProp = "EMBL"; //$NON-NLS-1$ final String sigNoteProp = "NOTE"; //$NON-NLS-1$ + final String sigPdfAProp = "PDFA"; //$NON-NLS-1$ + String sigLang = param.getSignatureLanguage(); String sigEmbl = (param.getEmblem() == null ? "" : param.getEmblem().getFileName()); //$NON-NLS-1$ String sigNote = param.getProperty("SIG_NOTE"); //$NON-NLS-1$ + String sigPdfA = param.getSignaturePdfACompat() ? Constants.TRUE : Constants.FALSE; Properties sigProps = new Properties(); // compare cache, try to load if match try { InputStream in = new FileInputStream(new File(fileDir, propFileName)); sigProps.load(in); - if (sigProps.getProperty(sigLangProp).equals(sigLang) && - sigProps.getProperty(sigEmblProp).equals(sigEmbl) && - sigProps.getProperty(sigNoteProp).equals(sigNote)) + if (sigLang.equals(sigProps.getProperty(sigLangProp)) && + sigEmbl.equals(sigProps.getProperty(sigEmblProp)) && + sigNote.equals(sigProps.getProperty(sigNoteProp)) && + sigPdfA.equals(sigProps.getProperty(sigPdfAProp))) { + log.debug("Placeholder cache hit"); //$NON-NLS-1$ return loadImage(fileDir, imgFileName, imgFileExt); + } + log.debug("Placeholder cache miss (" + //$NON-NLS-1$ + sigLang + "|" + sigProps.getProperty(sigLangProp) + " - " +//$NON-NLS-1$ //$NON-NLS-2$ + sigEmbl + "|" + sigProps.getProperty(sigEmblProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$ + sigNote + "|" + sigProps.getProperty(sigNoteProp) + " - " + //$NON-NLS-1$ //$NON-NLS-2$ + sigPdfA + "|" + sigProps.getProperty(sigPdfAProp) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Exception e) { log.debug("Can't load signature Placeholder", e); //$NON-NLS-1$ } @@ -90,6 +101,7 @@ public class SignaturePlaceholderCache { sigProps.setProperty(sigLangProp, sigLang); sigProps.setProperty(sigEmblProp, sigEmbl); sigProps.setProperty(sigNoteProp, sigNote); + sigProps.setProperty(sigPdfAProp, sigPdfA); OutputStream out = new FileOutputStream(new File(fileDir, propFileName)); sigProps.store(out, null); Image img = param.getPlaceholder(); |