aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/pdf/PDFGoTo.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFGoTo.java')
-rw-r--r--src/java/org/apache/fop/pdf/PDFGoTo.java44
1 files changed, 35 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFGoTo.java b/src/java/org/apache/fop/pdf/PDFGoTo.java
index a493a9f32..16eaf73ce 100644
--- a/src/java/org/apache/fop/pdf/PDFGoTo.java
+++ b/src/java/org/apache/fop/pdf/PDFGoTo.java
@@ -19,6 +19,8 @@
package org.apache.fop.pdf;
+import java.awt.geom.Point2D;
+
/**
* class representing a /GoTo object.
* This can either have a Goto to a page reference and location
@@ -47,6 +49,20 @@ public class PDFGoTo extends PDFAction {
}
/**
+ * create a /GoTo object.
+ *
+ * @param pageReference the PDF reference to the target page
+ * @param position the target area's on-page coordinates in points
+ */
+ public PDFGoTo(String pageReference, Point2D position) {
+ /* generic creation of object */
+ super();
+
+ this.pageReference = pageReference;
+ setPosition(position);
+ }
+
+ /**
* Sets page reference after object has been created
*
* @param pageReference the new page reference to use
@@ -56,6 +72,25 @@ public class PDFGoTo extends PDFAction {
}
/**
+ * Sets the target (X,Y) position
+ *
+ * @param position the target's on-page coordinates in points
+ */
+ public void setPosition(Point2D position) {
+ this.xPosition = (float) position.getX();
+ this.yPosition = (float) position.getY();
+ }
+
+ /**
+ * Sets the x Position to jump to
+ *
+ * @param xPosition x position
+ */
+ public void setXPosition(float xPosition) {
+ this.xPosition = xPosition;
+ }
+
+ /**
* Sets the Y position to jump to
*
* @param yPosition y position
@@ -74,15 +109,6 @@ public class PDFGoTo extends PDFAction {
}
/**
- * Sets the x Position to jump to
- *
- * @param xPosition x position
- */
- public void setXPosition(int xPosition) {
- this.xPosition = (xPosition / 1000f);
- }
-
- /**
* Get the PDF reference for the GoTo action.
*
* @return the PDF reference for the action