aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-pdfbox/src/main/java/at
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-07-25 11:28:13 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-07-25 11:28:13 +0200
commit2af992106a61df9d13d9d57fd98079715b0aeafa (patch)
tree6f8cbe59699b12a0fd062b2fe71c1c112aff4aff /pdf-as-pdfbox/src/main/java/at
parent98a9cd8175b3238f8a6f36c0369773111b390875 (diff)
downloadpdf-as-4-2af992106a61df9d13d9d57fd98079715b0aeafa.tar.gz
pdf-as-4-2af992106a61df9d13d9d57fd98079715b0aeafa.tar.bz2
pdf-as-4-2af992106a61df9d13d9d57fd98079715b0aeafa.zip
Fixed wrong line calculation for wrapping forced newline character
Diffstat (limited to 'pdf-as-pdfbox/src/main/java/at')
-rw-r--r--pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
index 82d21b0f..234cf7a2 100644
--- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
+++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java
@@ -386,7 +386,7 @@ public class PDFBoxTable {
for (int i = 0; i < words.length; i++) {
String word = words[i];
String[] lineBreaks = word.split("\n");
- if (lineBreaks.length > 1) {
+ if (lineBreaks.length > 1 || word.contains("\n")) {
for (int j = 0; j < lineBreaks.length; j++) {
String subword = lineBreaks[j];
// if (cLine + subword.length() > maxline) {
@@ -407,6 +407,10 @@ public class PDFBoxTable {
}
cLineValue += subword + " ";
}
+ if(lineBreaks.length == 1) {
+ lines.add(cLineValue.trim());
+ cLineValue = "";
+ }
} else {
String tmpLine = cLineValue + word;
float size = font.getStringWidth(tmpLine) / 1000.0f * fontSize;