diff options
Diffstat (limited to 'src/main/java/at/knowcenter/wag')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java | 30 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java | 2 |
2 files changed, 24 insertions, 8 deletions
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 == '-');
}
/**
|