diff options
author | wprinz <wprinz@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2008-06-16 12:24:14 +0000 |
---|---|---|
committer | wprinz <wprinz@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2008-06-16 12:24:14 +0000 |
commit | b1fc4f688639f938535558ec2dd245c115c6be16 (patch) | |
tree | 85e135dc0c2350d6109a6253898ed76fe4da7158 /src | |
parent | 7bb909f4091af4117679159d288703d2e8e4e0c7 (diff) | |
download | pdf-as-3-REL-3.0.6@290.tar.gz pdf-as-3-REL-3.0.6@290.tar.bz2 pdf-as-3-REL-3.0.6@290.zip |
line_break_tolerance über config.properties konfigurierbarREL-3.0.6@290
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@289 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src')
4 files changed, 29 insertions, 9 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignatorInformation.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignatorInformation.java index 0ed3699..16a473d 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignatorInformation.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignatorInformation.java @@ -34,6 +34,8 @@ public class BinarySignatorInformation implements SignatorInformation protected SignSignatureObject signSignatureObject = null;
protected ActualTablePos atp = null;
+
+ protected String signProfile = null;
/**
* @see at.gv.egiz.pdfas.framework.signator.SignatorInformation#getSignatureData()
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java index 395ae0e..10dc3d6 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java @@ -226,7 +226,7 @@ public class BinarySignator_1_0_0 implements Signator try
{
iui.signed_signature_object.kz = getMyId().toString();
- SignatureObject so = SignatureObjectHelper.convertSignSignatureObjectToSignatureObject(iui.signed_signature_object, iui.signProfile);
+ SignatureObjectHelper.convertSignSignatureObjectToSignatureObject(iui.signed_signature_object, iui.signProfile);
}
catch (PresentableException e)
{
@@ -320,6 +320,7 @@ public class BinarySignator_1_0_0 implements Signator bsi.enc_start = iui.enc_start;
bsi.enc_length = iui.enc_length;
bsi.atp = iui.actualTablePos;
+ bsi.signProfile = iui.signProfile;
return bsi;
}
@@ -337,6 +338,7 @@ public class BinarySignator_1_0_0 implements Signator iui.enc_start = bsi.enc_start;
iui.enc_length = bsi.enc_length;
iui.actualTablePos = bsi.atp;
+ iui.signProfile = bsi.signProfile;
iui.signed_signature_object = bsi.signSignatureObject;
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java index 02b1cd1..bb34040 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java @@ -17,13 +17,8 @@ */
package at.knowcenter.wag.egov.egiz.pdf;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
@@ -50,7 +45,6 @@ import at.knowcenter.wag.egov.egiz.exceptions.PlaceholderException; import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
-import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException;
import at.knowcenter.wag.egov.egiz.sig.SignatureFieldDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypeDefinition;
import at.knowcenter.wag.egov.egiz.sig.SignatureTypes;
@@ -667,6 +661,26 @@ public abstract class BinarySignature // }
// }
+ protected static int getLineBreakTolerance(IncrementalUpdateInformation iui) throws PDFDocumentException
+ {
+ SettingsReader settings;
+ try
+ {
+ settings = SettingsReader.getInstance();
+ }
+ catch (SettingsException e)
+ {
+ throw new PDFDocumentException(e.getErrorCode(), e);
+ }
+ String phLineBreakTolerance = SignatureTypeDefinition.readPhLenStringFromSettings(settings, iui.signProfile, "line_break_tolerance");
+ int lineBreakTolerance = LINE_BREAK_TOLERANCE;
+ if (phLineBreakTolerance != null)
+ {
+ lineBreakTolerance = Integer.parseInt(phLineBreakTolerance);
+ }
+ return lineBreakTolerance;
+ }
+
protected static int getCertificatePlaceholderLength(IncrementalUpdateInformation iui) throws SettingNotFoundException
{
SettingsReader settings;
@@ -1356,6 +1370,8 @@ public abstract class BinarySignature */
public static void replacePlaceholders(IncrementalUpdateInformation iui) throws PDFDocumentException
{
+ final int lineBreakTolerance = getLineBreakTolerance(iui);
+
final byte[] signed_pdf = iui.signed_pdf;
// int num_replaces = calcNumReps(iui.replaces);
@@ -1413,7 +1429,7 @@ public abstract class BinarySignature encoding_entry_index++;
}
- Placeholder.replacePlaceholderWithTolerance(signed_pdf, ri.replaces, replace_bytes, LINE_BREAK_TOLERANCE);
+ Placeholder.replacePlaceholderWithTolerance(signed_pdf, ri.replaces, replace_bytes, lineBreakTolerance);
}
catch (PlaceholderException e)
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java index 000b3c2..6523db9 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java @@ -352,7 +352,7 @@ public abstract class Placeholder */
protected static boolean canBreakAfter(byte character)
{
- return (character == ' ' || character == ',' || character == ';');
+ return (character == ' ' || character == ',' || character == ';' || character == '-');
}
/**
|