aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-08 15:34:11 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-08 15:34:11 +0000
commit0f58fa4b202c8dc56909d1403697fbf53b976307 (patch)
treea01a55533549d1eba54abb0327297df071d2504b /src/main/java/at/knowcenter
parentb1eb4a56149819ea97665b8e15a2d62876794534 (diff)
downloadpdf-as-3-0f58fa4b202c8dc56909d1403697fbf53b976307.tar.gz
pdf-as-3-0f58fa4b202c8dc56909d1403697fbf53b976307.tar.bz2
pdf-as-3-0f58fa4b202c8dc56909d1403697fbf53b976307.zip
improved alt text
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@603 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
index 19a32ac..55e77e0 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
@@ -3,8 +3,6 @@ package at.knowcenter.wag.egov.egiz.pdf;
import org.apache.log4j.Logger;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
-import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
-import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
@@ -30,9 +28,11 @@ import com.lowagie.text.pdf.PdfString;
*
*/
public class StructContentHelper {
+ private static final String ALT_TEXT_DEFAULT = "PDF-AS Signatur";
+
private static Logger logger = Logger.getLogger(StructContentHelper.class);
- private final static String ALT_TEXT_KEY = "sigBlockAltText";
+ private final static String ALT_TEXT_CONF_KEY = "sigBlockAltText";
private int nextMcid = 0;
private boolean isTagged = false;
@@ -56,7 +56,7 @@ public class StructContentHelper {
* Create and write structured content for signature block
* @throws PresentableException
*/
- void buildMainStructData(SignatureObject so, SignatorInformation si) throws PresentableException {
+ void buildMainStructData(SignatureObject so) throws PresentableException {
try {
@@ -143,7 +143,7 @@ public class StructContentHelper {
newStruct.put(PdfName.TYPE, new PdfName("StructElem"));
newStruct.put(PdfName.PG, page.getIndRef());
- newStruct.put(PdfName.ALT, new PdfString(createAltText(so, si)));
+ newStruct.put(PdfName.ALT, new PdfString(getAltText(so.getSignatureTypeDefinition().getType())));
newStruct.put(PdfName.K, new PdfNumber(nextMcid));
@@ -278,32 +278,10 @@ public class StructContentHelper {
private PdfDictionary getStructTreeRoot() {
return stamper.getReader().getCatalog().getAsDict(PdfName.STRUCTTREEROOT);
- }
-
- private String createAltText(SignatureObject so, SignatorInformation si) {
- String profileId = so.getSignatureTypeDefinition().getType();
- String res = getAltText(profileId); // ask config for alt text
- if (res == null) {
- // make default alt text
- StringBuilder sb = new StringBuilder("PDF-AS Signatur");
-
- try {
- if (so != null && so.getKZ() != null) {
- sb.append(". ").append(so.getKZ().toString());
- } else if (si != null) {
- sb.append(". ").append(si.getSignSignatureObject().kz);
- }
- } catch (InvalidIDException e) {
- logger.debug("error reading signature method for alt text string");
- }
- sb.append(". ").append(profileId);
- res = sb.toString();
- }
- return res;
- }
+ }
public static String getAltText(String sigProfile) {
- return AdobeSignatureHelper.getDefaultableConfigProperty(sigProfile, ALT_TEXT_KEY, null);
+ return AdobeSignatureHelper.getDefaultableConfigProperty(sigProfile, ALT_TEXT_CONF_KEY, ALT_TEXT_DEFAULT);
}