[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf/ui ...
Norman Richards
norman.richards at jboss.com
Sat Jan 20 15:04:30 EST 2007
User: nrichards
Date: 07/01/20 15:04:30
Modified: src/pdf/org/jboss/seam/pdf/ui UIDocument.java
Log:
improve page size options
Revision Changes Path
1.9 +24 -0 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIDocument.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIDocument.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIDocument.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- UIDocument.java 20 Jan 2007 07:41:23 -0000 1.8
+++ UIDocument.java 20 Jan 2007 20:04:30 -0000 1.9
@@ -30,6 +30,7 @@
String keywords;
String author;
String creator;
+ String orientation;
String pageSize;
String margins;
@@ -71,6 +72,10 @@
this.title = title;
}
+ public void setOrientation(String orientation) {
+ this.orientation = orientation;
+ }
+
public Object getITextObject() {
return document;
}
@@ -87,6 +92,25 @@
document.setPageSize(ITextUtils.pageSizeValue(pageSize));
}
+ System.out.println("page size was " + document.getPageSize().width() +
+ "x" + document.getPageSize().height());
+ orientation = (String) valueBinding(context, "orientation", orientation);
+ System.out.println("orientation: " + orientation);
+ if (orientation != null) {
+ if (orientation.equalsIgnoreCase("portrait")) {
+ // do nothing
+ } else if (orientation.equalsIgnoreCase("landscape")) {
+ Rectangle currentSize = document.getPageSize();
+ document.setPageSize(new Rectangle(currentSize.height(),
+ currentSize.width()));
+
+ } else {
+ throw new RuntimeException("orientation value " + orientation + "unknown");
+ }
+ }
+ System.out.println("page size is " + document.getPageSize().width() +
+ "x" + document.getPageSize().height());
+
margins = (String) valueBinding(context, "margins", margins);
if (margins != null) {
float[] vals = ITextUtils.stringToFloatArray(margins);
More information about the jboss-cvs-commits
mailing list