diff options
Diffstat (limited to 'pdf-as-lib/src/main/java/at')
3 files changed, 38 insertions, 7 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/positioning/Positioning.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/positioning/Positioning.java index da7da772..e0be68ee 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/positioning/Positioning.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/positioning/Positioning.java @@ -156,7 +156,7 @@ public class Positioning { { page++; } - return new PositioningInstruction(make_new_page, page, pos_x, pos_y); + return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation); } // pos_y is auto if (make_new_page) @@ -164,7 +164,7 @@ public class Positioning { // ignore footer in new page page++; pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; - return new PositioningInstruction(make_new_page, page, pos_x, pos_y); + return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation); } // up to here no checks have to be made if Tablesize and Pagesize are fit // Now we have to getfreespace in page and reguard footerline @@ -188,7 +188,7 @@ public class Positioning { // no text --> SIGNATURE_BORDER pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } - return new PositioningInstruction(make_new_page, page, pos_x, pos_y); + return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation); } final float page_length = pre_page_length; // we do have text take SIGNATURE_MARGIN @@ -206,7 +206,7 @@ public class Positioning { // no text --> SIGNATURE_BORDER pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } - return new PositioningInstruction(make_new_page, page, pos_x, pos_y); + return new PositioningInstruction(make_new_page, page, pos_x, pos_y, pos.rotation); } finally { if (pdfDataSource != null) { try { 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;
}
}
|