diff options
author | Jeremias Maerki <jeremias@apache.org> | 2007-05-07 12:22:22 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2007-05-07 12:22:22 +0000 |
commit | 719a8a50772a780263366f9286f7f132f4561e0c (patch) | |
tree | 4c0ebcbb84750d5f42901b3315afb1f654e11655 /src/java/org/apache/fop/pdf/PDFGoTo.java | |
parent | 283e22abdafff51ac4b5aefcdc7fe06ca9cfb61e (diff) | |
download | xmlgraphics-fop-719a8a50772a780263366f9286f7f132f4561e0c.tar.gz xmlgraphics-fop-719a8a50772a780263366f9286f7f132f4561e0c.zip |
Bugzilla #42067:
Add support for exact positioning of internal PDF links.
Submitted by: Paul Vinkenoog <paul.at.vinkenoog.nl>
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@535866 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFGoTo.java')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFGoTo.java | 44 |
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 |