aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-11-02 11:23:51 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-11-02 11:23:51 +0100
commit4ee4d80447ac654848d2c1d77deafde771bf4177 (patch)
tree8dcf53c9daabc17ae9c76293509d3a5621bf59cc
parent55c407fce46a1f100398b9cbe405b1560ea6d75e (diff)
parent3e46f2b7ba2bf497a8f73d5f2498850f27904ff1 (diff)
downloadpdf-as-4-4ee4d80447ac654848d2c1d77deafde771bf4177.tar.gz
pdf-as-4-4ee4d80447ac654848d2c1d77deafde771bf4177.tar.bz2
pdf-as-4-4ee4d80447ac654848d2c1d77deafde771bf4177.zip
Merge branch 'master' of gitlab.iaik.tugraz.at:afitzek/pdf-as-4
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java29
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java3
-rw-r--r--pdf-as-web/build.gradle7
3 files changed, 27 insertions, 12 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
index e35e3994..17ee60be 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
@@ -85,8 +85,22 @@ public class PDFBoxTable {
case Entry.TYPE_CAPTION:
case Entry.TYPE_VALUE:
String value = (String) cell.getValue();
- cell.setValue(StringUtils
- .convertStringToPDFFormat(value));
+
+ //Check if the used value font supports all characters in string
+ PDFont f = null;
+ try{
+ if(valueFont != null){
+ f = valueFont.getFont();
+ f.getStringWidth(value);
+ }
+ }catch(IllegalArgumentException | IOException e){
+ if(f!=null){
+ logger.warn("Font "+f.getName()+" doesnt support a character in the value "+value);
+ }
+ value = StringUtils.convertStringToPDFFormat(value);
+ cell.setValue(value);
+ }
+
break;
}
}
@@ -99,11 +113,6 @@ public class PDFBoxTable {
private void initializeStyle(Table abstractTable, PDFBoxTable parent,
PDFBOXObject pdfBoxObject) throws IOException {
this.table = abstractTable;
- try {
- normalizeContent(abstractTable);
- } catch (PdfAsException e) {
- throw new PdfAsWrappedIOException(e);
- }
if (parent != null) {
style = Style.doInherit(abstractTable.getStyle(), parent.style);
@@ -148,6 +157,12 @@ public class PDFBoxTable {
padding = style.getPadding();
bgColor = style.getBgColor();
+
+ try {
+ normalizeContent(abstractTable);
+ } catch (PdfAsException e) {
+ throw new PdfAsWrappedIOException(e);
+ }
}
public PDFBoxTable(Table abstractTable, PDFBoxTable parent, float fixSize,
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java
index aa2a397d..5162b287 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java
@@ -246,8 +246,9 @@ public class TableDrawUtils {
contentStream.moveTextPositionByAmount(tx, (ty - fontSize + (descent * (-1))));
contentStream.appendRawCommands(fontSize + " TL\n");
+
for (int k = 0; k < tlines.length; k++) {
- contentStream.drawString(tlines[k]);
+ contentStream.showText(tlines[k]);
if (k < tlines.length - 1) {
contentStream.appendRawCommands("T*\n");
}
diff --git a/pdf-as-web/build.gradle b/pdf-as-web/build.gradle
index 0fb333eb..ae27c7db 100644
--- a/pdf-as-web/build.gradle
+++ b/pdf-as-web/build.gradle
@@ -173,7 +173,7 @@ task putConfigIntoTomcat(dependsOn: putTemplateIntoTomcat)<<{
task putWebConfigIntoTomcat(dependsOn: putConfigIntoTomcat)<<{
deployVersions.each{
- String targetDir = "build/tomcat-##VERSION##/apache-tomcat-##VERSION##/conf/pdf-as";
+ String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/conf/pdf-as";
targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion);
copy{
@@ -203,7 +203,7 @@ task createPdfbox2War(type:War){
sourceSets.test.compileClasspath -= configurations.pdfbox1
sourceSets.main.compileClasspath += configurations.pdfbox2
sourceSets.test.compileClasspath += configurations.pdfbox2
- classpath=sourceSets.main.compileClasspath
+ classpath+=sourceSets.main.compileClasspath
}
}
@@ -283,14 +283,13 @@ task releaseConfig(type: Copy) {
-
war{
doFirst{
sourceSets.main.compileClasspath -= configurations.pdfbox2
sourceSets.test.compileClasspath -= configurations.pdfbox2
sourceSets.main.compileClasspath += configurations.pdfbox1
sourceSets.test.compileClasspath += configurations.pdfbox1
- classpath=sourceSets.main.compileClasspath
+ classpath+=sourceSets.main.compileClasspath
}
}