aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-12 09:33:05 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-12 09:33:05 +0000
commit09341ba86d33b02633e9ad2c2232c586cc671011 (patch)
tree0c647819ef6ecc44311dd73f39be7a6e42c0019d /src/main
parent4ce2fbc415f2fae57842b2e13a0817bb63594434 (diff)
downloadpdf-as-3-09341ba86d33b02633e9ad2c2232c586cc671011.tar.gz
pdf-as-3-09341ba86d33b02633e9ad2c2232c586cc671011.tar.bz2
pdf-as-3-09341ba86d33b02633e9ad2c2232c586cc671011.zip
fixed linebreak problem
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@543 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java10
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java20
2 files changed, 12 insertions, 18 deletions
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 9155f15..fce5dea 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
@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import javax.sound.midi.SysexMessage;
+
import org.apache.commons.codec.net.URLCodec;
import org.apache.log4j.Logger;
@@ -352,7 +354,7 @@ public abstract class Placeholder
*/
protected static boolean canBreakAfter(byte character)
{
- return (character == ' ' || character == ',' || character == ';' || character == '-');
+ return (character == ' ' || character == ',' || character == ';' || character == '-' || character == '\n') ;
}
/**
@@ -532,6 +534,7 @@ public abstract class Placeholder
{
byte data = bytes[index];
+
// byte [] escaped_data = escapeByte(data);
baos.write(data);
@@ -541,10 +544,13 @@ public abstract class Placeholder
}
}
+ System.err.println("token: " + baos.toString());
return baos.toByteArray();
}
- protected static byte[] escapeToken(byte[] token) throws IOException
+
+
+protected static byte[] escapeToken(byte[] token) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
index 45afaf7..b407b61 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/SplitStrings.java
@@ -112,29 +112,17 @@ public class SplitStrings
*/
public void write(byte[] data)
{
- data = tryProcessNewline(data);
if (!fits(data))
{
throw new IllegalArgumentException("The data doesn't fit in.");
}
System.arraycopy(data, 0, this.pdf, this.strings[this.cur_string].string_start + this.cur_pos, data.length);
-
this.cur_pos += data.length;
- }
-
- /**
- * Process starting \n token if found
- * @param data
- * @return
- */
- private byte[] tryProcessNewline(byte[] data) {
- if (data.length > 0 && data[0] == '\n') {
- // new line token \n found
- newline();
- data = ArrayUtils.subarray(data, 1, data.length);
- }
- return data;
+
+ if (data[data.length-1] == '\n') {
+ newline();
+ }
}
/**