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 | |
parent | b1d832da0a2b9da58d94c529ab8d0e4aabcb4c0b (diff) | |
download | pdf-over-683f42f194a30e70d4d09f4bac779d15526e1436.tar.gz pdf-over-683f42f194a30e70d4d09f4bac779d15526e1436.tar.bz2 pdf-over-683f42f194a30e70d4d09f4bac779d15526e1436.zip |
Make PDF/A compatibility configurable
Diffstat (limited to 'pdf-over-gui/src/main/java/at')
13 files changed, 218 insertions, 93 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java index dffcec0f..16c5f7cf 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java @@ -101,6 +101,9 @@ public class Constants { /** Update URL */ public static final String UPDATE_URL = "http://webstart.buergerkarte.at/PDF-Over/"; //$NON-NLS-1$ + /** True */ + public static final String TRUE = "true"; //$NON-NLS-1$ + /** False */ public static final String FALSE = "false"; //$NON-NLS-1$ @@ -121,7 +124,7 @@ public class Constants { */ public static final String CFG_SIGNATURE_POSITION = "SIGNATURE_POSITION"; //$NON-NLS-1$ - /** This signature placeholder transparency config parameter (0-255) */ + /** The signature placeholder transparency config parameter (0-255) */ public static final String CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY = "SIGNATURE_PLACEHOLDER_TRANSPARENCY"; //$NON-NLS-1$ /** The mobile number config parameter */ @@ -133,6 +136,9 @@ public class Constants { /** The signature locale config parameter */ public static final String CFG_SIGNATURE_LOCALE = "SIGNLOCALE"; //$NON-NLS-1$ + /** The PDF/A-compatibility config parameter */ + public static final String CFG_SIGNATURE_PDFA_COMPAT = "SIGNATURE_PDFA_COMPAT"; //$NON-NLS-1$ + /** Mobile bku url config parameter */ public static final String CFG_MOBILE_BKU_URL = "MOBILE_BKU_URL"; //$NON-NLS-1$ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java index 548d5767..8ca12de1 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/AdvancedConfigurationComposite.java @@ -73,6 +73,7 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { private Group grpSignatur; Button btnAutomatischePositionierung; + Button btnPdfACompat; private Label lblTransparenz; private Label lblTransparenzLinks; private Label lblTransparenzRechts; @@ -162,10 +163,36 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { } }); + this.btnPdfACompat = new Button(this.grpSignatur, SWT.CHECK); + FormData fd_btnPdfACompat = new FormData(); + fd_btnPdfACompat.right = new FormAttachment(100, -5); + fd_btnPdfACompat.top = new FormAttachment( + this.btnAutomatischePositionierung, 5); + fd_btnPdfACompat.left = new FormAttachment(0, 5); + this.btnPdfACompat + .setLayoutData(fd_btnPdfACompat); + + FontData[] fD_btnPdfACompat = this.btnPdfACompat + .getFont().getFontData(); + fD_btnPdfACompat[0] + .setHeight(Constants.TEXT_SIZE_BUTTON); + this.btnPdfACompat.setFont(new Font(Display + .getCurrent(), fD_btnPdfACompat[0])); + + this.btnPdfACompat + .addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AdvancedConfigurationComposite.this + .performPdfACompatSelection(AdvancedConfigurationComposite.this.btnPdfACompat + .getSelection()); + } + }); + this.lblTransparenz = new Label(this.grpSignatur, SWT.HORIZONTAL); FormData fd_lblTransparenz = new FormData(); fd_lblTransparenz.top = new FormAttachment( - this.btnAutomatischePositionierung, 5); + this.btnPdfACompat, 5); fd_lblTransparenz.left = new FormAttachment(0, 5); this.lblTransparenz.setLayoutData(fd_lblTransparenz); @@ -775,6 +802,11 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { this.btnAutomatischePositionierung.setSelection(automatic); } + void performPdfACompatSelection(boolean compat) { + this.configurationContainer.setSignaturePdfACompat(compat); + this.btnPdfACompat.setSelection(compat); + } + void performPlaceholderTransparency(int transparency) { this.configurationContainer.setPlaceholderTransparency(transparency); } @@ -890,19 +922,20 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { @Override public void loadConfiguration() { // load advanced settings - this.performBKUSelectionChanged(this.configurationContainer + performBKUSelectionChanged(this.configurationContainer .getDefaultBKU()); String outputFolder = this.configurationContainer.getOutputFolder(); if (outputFolder != null) { - this.performOutputFolderChanged(outputFolder); + performOutputFolderChanged(outputFolder); } SignaturePosition pos = this.configurationContainer .getDefaultSignaturePosition(); - this.performPositionSelection(pos != null && pos.useAutoPositioning()); + performPositionSelection(pos != null && pos.useAutoPositioning()); this.sclTransparenz.setSelection(this.configurationContainer .getPlaceholderTransparency()); - this.performLocaleSelectionChanged(this.configurationContainer.getLocale()); - this.performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); + performLocaleSelectionChanged(this.configurationContainer.getLocale()); + performPdfACompatSelection(this.configurationContainer.getSignaturePdfACompat()); + performUpdateCheckSelection(this.configurationContainer.getUpdateCheck()); int port = this.configurationContainer.getProxyPort(); if (port > 0) { @@ -972,6 +1005,8 @@ public class AdvancedConfigurationComposite extends BaseConfigurationComposite { .getString("advanced_config.Signature_Title")); //$NON-NLS-1$ this.btnAutomatischePositionierung.setText(Messages .getString("advanced_config.AutoPosition")); //$NON-NLS-1$ + this.btnPdfACompat.setText(Messages + .getString("advanced_config.PdfACompat")); //$NON-NLS-1$ this.btnAutomatischePositionierung.setToolTipText(Messages .getString("advanced_config.AutoPosition_ToolTip")); //$NON-NLS-1$ this.lblTransparenz.setText(Messages diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 2f8abadb..407b493b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -288,11 +288,13 @@ public class ConfigurationComposite extends StateComposite { this.configurationContainer.setSignatureNote( this.configProvider.getSignatureNote()); - + this.configurationContainer.setLocale(this.configProvider.getLocale()); - - this.configurationContainer.setSignLocale(this.configProvider.getSignLocale()); - + + this.configurationContainer.setSignatureLocale(this.configProvider.getSignatureLocale()); + + this.configurationContainer.setSignaturePdfACompat(this.configProvider.getSignaturePdfACompat()); + this.configurationContainer.setDefaultBKU(this.configProvider .getDefaultBKUPersistent()); try { @@ -410,8 +412,11 @@ public class ConfigurationComposite extends StateComposite { .setDefaultSignaturePosition(this.configurationContainer.getDefaultSignaturePosition()); this.configManipulator.setLocale(this.configurationContainer.getLocale()); - this.configManipulator.setSignLocale(this.configurationContainer.getSignLocale()); - + + this.configManipulator.setSignatureLocale(this.configurationContainer.getSignatureLocale()); + + this.configManipulator.setSignaturePdfACompat(this.configurationContainer.getSignaturePdfACompat()); + this.configManipulator .setPlaceholderTransparency(this.configurationContainer .getPlaceholderTransparency()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index a5e0461e..9f1f53a5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -420,7 +420,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { @Override public void widgetSelected(SelectionEvent e) { Locale currentLocale = SimpleConfigurationComposite.this.configurationContainer - .getSignLocale(); + .getSignatureLocale(); Locale selectedLocale = Constants. SUPPORTED_LOCALES[SimpleConfigurationComposite.this.cmbSignatureLang .getSelectionIndex()]; @@ -512,7 +512,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { public void widgetSelected(SelectionEvent e) { SimpleConfigurationComposite.this.txtSignatureNote.setText( Messages.getString("simple_config.Note_Default", //$NON-NLS-1$ - SimpleConfigurationComposite.this.configurationContainer.getSignLocale())); + SimpleConfigurationComposite.this.configurationContainer.getSignatureLocale())); } }); @@ -663,34 +663,21 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { ImageData logo = null; try { - - if (image == null || image.trim().isEmpty()) { - if (this.signer != null) { - SignatureParameter param = this.signer.getPDFSigner() - .newParameter(); - if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ - } - - param.setSignatureLanguage(this.configurationContainer.getSignLocale().getLanguage()); - - img = SignaturePlaceholderCache.getSWTPlaceholder(param); + if (this.signer != null) { + SignatureParameter param = this.signer.getPDFSigner() + .newParameter(); + if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { + param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ } - } else { - if (this.signer != null) { - SignatureParameter param = this.signer.getPDFSigner() - .newParameter(); - if(this.configurationContainer.getSignatureNote() != null && !this.configurationContainer.getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", this.configurationContainer.getSignatureNote()); //$NON-NLS-1$ - } - - param.setSignatureLanguage(this.configurationContainer.getSignLocale().getLanguage()); + + param.setSignatureLanguage(this.configurationContainer.getSignatureLocale().getLanguage()); + param.setSignaturePdfACompat(this.configurationContainer.getSignaturePdfACompat()); + if (image != null && !image.trim().isEmpty()) { + logo = new ImageData(image); param.setEmblem(new FileNameEmblem(image)); - img = SignaturePlaceholderCache.getSWTPlaceholder(param); - } else { - img = new ImageData(image); } - logo = new ImageData(image); + + img = SignaturePlaceholderCache.getSWTPlaceholder(param); } } catch (Exception e) { log.error("Failed to load image for display...", e); //$NON-NLS-1$ @@ -751,7 +738,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { void performSignatureLangSelectionChanged(Locale selected) { log.debug("Selected Sign Locale: " + selected); //$NON-NLS-1$ - this.configurationContainer.setSignLocale(selected); + this.configurationContainer.setSignatureLocale(selected); this.cmbSignatureLang.select(this.getLocaleElementIndex(selected)); } @@ -850,7 +837,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.setVisibleImage(); - this.performSignatureLangSelectionChanged(this.configurationContainer.getSignLocale()); + this.performSignatureLangSelectionChanged(this.configurationContainer.getSignatureLocale()); } /* 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(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java index d04d59c1..346c59ae 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java @@ -109,7 +109,13 @@ public interface ConfigManipulator { * Sets the signature locale to be used * @param locale the signature locale */ - public void setSignLocale(Locale locale); + public void setSignatureLocale(Locale locale); + + /** + * Set the signature PDF/A compatibility setting + * @param compat whether to use PDF/A compatibility + */ + public void setSignaturePdfACompat(boolean compat); /** * Sets whether to automatically check for application updates diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java index c9a8d616..d4489e27 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java @@ -148,7 +148,13 @@ public interface ConfigProvider { * Gets the configured locale * @return the configured locale */ - public Locale getSignLocale(); + public Locale getSignatureLocale(); + + /** + * Get the signature PDF/A compatibility setting + * @return the signature PDF/A compatibility setting + */ + public boolean getSignaturePdfACompat(); /** * Gets whether to automatically check for application updates diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index b5175141..5ec55555 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -119,14 +119,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (targetLocale != null) { setLocale(targetLocale); } + + String signatureLocaleString = config.getProperty(Constants.CFG_SIGNATURE_LOCALE); - String signlocalString = config.getProperty(Constants.CFG_SIGNATURE_LOCALE); - - Locale signtargetLocale = LocaleSerializer.parseFromString(signlocalString); - if (signtargetLocale != null) { - setSignLocale(signtargetLocale); + Locale signatureTargetLocale = LocaleSerializer.parseFromString(signatureLocaleString); + if (signatureTargetLocale != null) { + setSignatureLocale(signatureTargetLocale); } - + + String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); + if (compat != null) + setSignaturePdfACompat(!compat.equalsIgnoreCase(Constants.FALSE)); + String bkuUrl = config .getProperty(Constants.CFG_MOBILE_BKU_URL); @@ -288,16 +292,16 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, Properties props = new Properties(); props.clear(); - props.setProperty(Constants.CFG_BKU, this.getDefaultBKUPersistent().toString()); - props.setProperty(Constants.CFG_PROXY_HOST, this.getProxyHostPersistent()); + props.setProperty(Constants.CFG_BKU, getDefaultBKUPersistent().toString()); + props.setProperty(Constants.CFG_PROXY_HOST, getProxyHostPersistent()); props.setProperty(Constants.CFG_PROXY_PORT, Integer.toString(getProxyPortPersistent())); - props.setProperty(Constants.CFG_PROXY_USER, this.getProxyUserPersistent()); - props.setProperty(Constants.CFG_PROXY_PASS, this.getProxyPassPersistent()); - props.setProperty(Constants.CFG_EMBLEM, this.getDefaultEmblemPersistent()); - props.setProperty(Constants.CFG_SIGNATURE_NOTE, this.getSignatureNote()); - props.setProperty(Constants.CFG_MOBILE_NUMBER, this.getDefaultMobileNumberPersistent()); - props.setProperty(Constants.CFG_OUTPUT_FOLDER, this.getDefaultOutputFolderPersistent()); + props.setProperty(Constants.CFG_PROXY_USER, getProxyUserPersistent()); + props.setProperty(Constants.CFG_PROXY_PASS, getProxyPassPersistent()); + props.setProperty(Constants.CFG_EMBLEM, getDefaultEmblemPersistent()); + props.setProperty(Constants.CFG_SIGNATURE_NOTE, getSignatureNote()); + props.setProperty(Constants.CFG_MOBILE_NUMBER, getDefaultMobileNumberPersistent()); + props.setProperty(Constants.CFG_OUTPUT_FOLDER, getDefaultOutputFolderPersistent()); props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, Integer.toString(getPlaceholderTransparency())); @@ -309,13 +313,15 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, props.setProperty(Constants.CFG_LOCALE, LocaleSerializer.getParsableString(configLocale)); } - Locale signLocale = this.getSignLocale(); - if(signLocale != null) { - props.setProperty(Constants.CFG_SIGNATURE_LOCALE, LocaleSerializer.getParsableString(signLocale)); + Locale signatureLocale = this.getSignatureLocale(); + if(signatureLocale != null) { + props.setProperty(Constants.CFG_SIGNATURE_LOCALE, LocaleSerializer.getParsableString(signatureLocale)); } - SignaturePosition pos = getDefaultSignaturePositionPersistent(); + if (!getSignaturePdfACompat()) + props.setProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT, Constants.FALSE); + SignaturePosition pos = getDefaultSignaturePositionPersistent(); if (pos == null) { props.setProperty(Constants.CFG_SIGNATURE_POSITION, ""); //$NON-NLS-1$ } else if (pos.useAutoPositioning()) { @@ -999,29 +1005,45 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setSignLocale(java.util.Locale) + * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setSignatureLocale(java.util.Locale) */ @Override - public void setSignLocale(Locale locale) { + public void setSignatureLocale(Locale locale) { if(locale == null) { - this.configuration.setSignLocale(Messages.getDefaultLocale()); + this.configuration.setSignatureLocale(Messages.getDefaultLocale()); } else { - this.configuration.setSignLocale(locale); + this.configuration.setSignatureLocale(locale); } } /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignLocale() + * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureLocale() */ @Override - public Locale getSignLocale() { - Locale locale = this.configuration.getSignLocale(); + public Locale getSignatureLocale() { + Locale locale = this.configuration.getSignatureLocale(); if (locale == null) locale = Messages.getDefaultLocale(); return locale; } /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setSignaturePdfACompat(boolean) + */ + @Override + public void setSignaturePdfACompat(boolean compat) { + this.configuration.setSignaturePdfACompat(compat); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getSignaturePdfACompat() + */ + @Override + public boolean getSignaturePdfACompat() { + return this.configuration.getSignaturePdfACompat(); + } + + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setUpdateCheck(boolean) */ @Override diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 24cd46bb..6d5e888e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -187,13 +187,25 @@ public interface ConfigurationContainer { * Gets the signature locale * @return the signature locale */ - public Locale getSignLocale(); + public Locale getSignatureLocale(); /** * Sets the signature locale * @param locale the signature locale */ - public void setSignLocale(Locale locale); + public void setSignatureLocale(Locale locale); + + /** + * Gets the signature PDF/A compatibility setting + * @return the signature PDF/A compatibility setting + */ + public boolean getSignaturePdfACompat(); + + /** + * Sets the signature PDF/A compatibility setting + * @param compat the signature PDF/A compatibility setting + */ + public void setSignaturePdfACompat(boolean compat); /** * Gets the mobile BKU URL diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index 83f35b65..726e5b4b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -77,7 +77,10 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { protected Locale locale = null; /** Holds the signature locale */ - protected Locale signLocale = null; + protected Locale signatureLocale = null; + + /** Holds the PDF/A compatibility setting */ + protected boolean pdfACompat = true; /** Holds the output folder */ protected String folder = null; @@ -360,20 +363,38 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignLocale() + * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#getSignatureLocale() + */ + @Override + public Locale getSignatureLocale() { + return this.signatureLocale; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignatureLocale(java.util.Locale) + */ + @Override + public void setSignatureLocale(Locale locale) { + this.signatureLocale = locale; + } + + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getSignaturePdfACompat() */ @Override - public Locale getSignLocale() { - return this.signLocale; + public boolean getSignaturePdfACompat() { + return this.pdfACompat; } /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigurationContainer#setSignLocale(java.util.Locale) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setSignaturePdfACompat(boolean) */ @Override - public void setSignLocale(Locale locale) { - this.signLocale = locale; + public void setSignaturePdfACompat(boolean compat) { + this.pdfACompat = compat; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java index 9b857fa7..26a98def 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java @@ -125,7 +125,13 @@ public interface PersistentConfigProvider { * Gets the configured locale * @return the configured locale */ - public Locale getSignLocale(); + public Locale getSignatureLocale(); + + /** + * Get the signature PDF/A compatibility setting + * @return the signature PDF/A compatibility setting + */ + public boolean getSignaturePdfACompat(); /** * Gets whether to automatically check for application updates diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 6c3d11a8..ae1303c8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -35,6 +35,7 @@ import at.asit.pdfover.gui.utils.Messages; import at.asit.pdfover.gui.utils.SignaturePlaceholderCache; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; +import at.asit.pdfover.gui.workflow.config.ConfigProvider; import at.asit.pdfover.signator.Emblem; import at.asit.pdfover.signator.FileNameEmblem; import at.asit.pdfover.signator.SignatureParameter; @@ -93,27 +94,30 @@ public class PositioningState extends State { } private PositioningComposite getPositioningComposite(PDFFile document) { + StateMachine stateMachine = getStateMachine(); if (this.positionComposite == null) { this.positionComposite = - getStateMachine().getGUIProvider().createComposite(PositioningComposite.class, SWT.RESIZE, this); - log.debug("Displaying " + getStateMachine().getStatus().getDocument()); //$NON-NLS-1$ + stateMachine.getGUIProvider().createComposite(PositioningComposite.class, SWT.RESIZE, this); + log.debug("Displaying " + stateMachine.getStatus().getDocument()); //$NON-NLS-1$ this.positionComposite.displayDocument(document); } // Update possibly changed values - SignatureParameter param = getStateMachine().getPDFSigner().getPDFSigner().newParameter(); - Emblem emblem = new FileNameEmblem(getStateMachine().getConfigProvider().getDefaultEmblem()); + ConfigProvider config = stateMachine.getConfigProvider(); + SignatureParameter param = stateMachine.getPDFSigner().getPDFSigner().newParameter(); + Emblem emblem = new FileNameEmblem(config.getDefaultEmblem()); param.setEmblem(emblem); - if(getStateMachine().getConfigProvider().getSignatureNote() != null && !getStateMachine().getConfigProvider().getSignatureNote().isEmpty()) { - param.setProperty("SIG_NOTE", getStateMachine().getConfigProvider().getSignatureNote()); //$NON-NLS-1$ + if(config.getSignatureNote() != null && !config.getSignatureNote().isEmpty()) { + param.setProperty("SIG_NOTE", config.getSignatureNote()); //$NON-NLS-1$ } - - param.setSignatureLanguage(getStateMachine().getConfigProvider().getSignLocale().getLanguage()); - + + param.setSignatureLanguage(config.getSignatureLocale().getLanguage()); + param.setSignaturePdfACompat(config.getSignaturePdfACompat()); + this.positionComposite.setPlaceholder( SignaturePlaceholderCache.getPlaceholder(param), param.getPlaceholderDimension().getWidth(), param.getPlaceholderDimension().getHeight(), - getStateMachine().getConfigProvider().getPlaceholderTransparency()); + config.getPlaceholderTransparency()); if (this.previousPosition != null && !this.previousPosition.useAutoPositioning()) this.positionComposite.setPosition( this.previousPosition.getX(), diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index d64c1843..21664d85 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -155,9 +155,12 @@ public class PrepareSigningState extends State { } this.state.signatureParameter - .setSignatureLanguage(configuration.getSignLocale() + .setSignatureLanguage(configuration.getSignatureLocale() .getLanguage()); + this.state.signatureParameter + .setSignaturePdfACompat(configuration.getSignaturePdfACompat()); + this.state.signingState = this.state.signer .prepare(this.state.signatureParameter); |