From 6d416edf737b9899aef7194aa66c35103dba07ce Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 11 Feb 2014 08:19:04 +0100 Subject: Support rotation of the signature block by r attribute in pos string --- .../wag/egov/egiz/pdf/PositioningInstruction.java | 18 +++++++++++++++++- .../at/knowcenter/wag/egov/egiz/pdf/TablePos.java | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/knowcenter') diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java index 0fe399c4..d0c1afc1 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java @@ -66,6 +66,11 @@ public class PositioningInstruction * be placed. */ protected float y = 0.0f; + + /** + * The rotation of the signature block + */ + protected float rotation = 0.0f; /** * @@ -84,12 +89,13 @@ public class PositioningInstruction * The y coordinate where the upper left corner of the signature * block should be placed. */ - public PositioningInstruction(boolean make_new_page, int page, float x, float y) + public PositioningInstruction(boolean make_new_page, int page, float x, float y, float rotation) { this.make_new_page = make_new_page; this.page = page; this.x = x; this.y = y; + this.rotation = rotation; } /** @@ -135,6 +141,11 @@ public class PositioningInstruction { return this.y; } + + public float getRotation() + { + return this.rotation; + } public int hashCode() { final int prime = 31; @@ -143,6 +154,7 @@ public class PositioningInstruction result = prime * result + page; result = prime * result + Float.floatToIntBits(x); result = prime * result + Float.floatToIntBits(y); + result = prime * result + Float.floatToIntBits(rotation); return result; } @@ -162,6 +174,8 @@ public class PositioningInstruction return false; if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) return false; + if (Float.floatToIntBits(rotation) != Float.floatToIntBits(other.rotation)) + return false; return true; } @@ -175,6 +189,8 @@ public class PositioningInstruction buffer.append(x); buffer.append(", y="); buffer.append(y); + buffer.append(", r="); + buffer.append(rotation); buffer.append("]"); return buffer.toString(); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java index 92afaf98..7bf2103b 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/TablePos.java @@ -68,6 +68,11 @@ public class TablePos implements Serializable * The top y position of the footer line. */ public float footer_line = 0.0f; + + /** + * The rotation of the signature block + */ + public float rotation = 0.0f; /** * The y position. @@ -134,7 +139,7 @@ public class TablePos implements Serializable * Constructor. * * @param pos_string The pos instruction. - * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo] + * format : [x:x_algo];[y:y_algo];[w:w_algo][p:p_algo];[f:f_algo];[r:r_algo] * x_algo:='auto' ... automatic positioning x * floatvalue ... absolute x * y_algo:='auto' ... automatic positioning y @@ -145,6 +150,7 @@ public class TablePos implements Serializable * 'new' ... new page * intvalue ... pagenumber * f_algo floatvalue ... consider footerline (only if y_algo is auto and p_algo is not 'new') + * r_algo floatvalue ... rotate the table arround the lower left corner anti clockwise in degree * @throws PdfAsException */ public TablePos(String pos_string) throws PdfAsException @@ -241,6 +247,15 @@ public class TablePos implements Serializable this.footer_line = flval; break; } + case 'r': { + float flval=Float.parseFloat(commandval); + if (flval<0) + { + throw new PdfAsException("Pos string (=" + pos_string + ") is invalid."); + } + this.rotation = flval; + break; + } default : { throw new PdfAsException("Pos string (=" + pos_string + ") is invalid."); } @@ -255,7 +270,7 @@ public class TablePos implements Serializable } public String toString() { - String thatsme = "cmd:"+this.myposstring+" pos_x:"+this.pos_x+" pos_y:"+this.pos_y+" page:"+this.page+" width:"+this.width+" footer:"+this.footer_line+"\n "+" autoX:"+this.autoX+" autoY:"+this.autoY+" autoW:"+this.autoW+" Newpage:"+this.newpage+" autoP:"+this.autoP; + String thatsme = "cmd:"+this.myposstring+" pos_x:"+this.pos_x+" pos_y:"+this.pos_y+" page:"+this.page+" width:"+this.width+" footer:"+this.footer_line+" rotation:"+this.rotation+"\n "+" autoX:"+this.autoX+" autoY:"+this.autoY+" autoW:"+this.autoW+" Newpage:"+this.newpage+" autoP:"+this.autoP; return thatsme; } } -- cgit v1.2.3