From 6a5f719385be496af9d8fede33a8af0b5e2c7815 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Fri, 25 Apr 2008 11:27:19 +0000 Subject: Bugzilla 44634: Added partial implementation for show-destination. Only works for PDF output, when the PDF is opened in a standalone viewer, and for links that point to destinations in another PDF document. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@651575 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/render/pdf/PDFRenderer.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/java/org/apache/fop/render/pdf') diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 936bf4384..06f5921cc 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -837,7 +837,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { * @param value the value * @return the formatted value */ - protected static final String format(float value) { + protected static String format(float value) { return PDFNumber.doubleOut(value); } @@ -1134,9 +1134,11 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { * (i.e. if the area qualifies as a link target). * Otherwise, or if the area has no id, null is returned. * - * NOTE : area must be on currentPageViewport, otherwise result may be wrong! + * NOTE: area must be on currentPageViewport, otherwise result may be wrong! * * @param area the area for which to return the id + * @return the area's id (null if the area has no id or + * other preceding areas have the same id) */ protected String getTargetableID(Area area) { String id = (String) area.getTrait(Trait.PROD_ID); @@ -1374,11 +1376,14 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { // no INTERNAL_LINK, look for EXTERNAL_LINK if (!linkTraitFound) { - String extDest = (String) ip.getTrait(Trait.EXTERNAL_LINK); - if (extDest != null && extDest.length() > 0) { - linkTraitFound = true; - if (annotsAllowed) { - action = factory.getExternalAction(extDest); + Trait.ExternalLink extLink = (Trait.ExternalLink) ip.getTrait(Trait.EXTERNAL_LINK); + if (extLink != null) { + String extDest = extLink.getDestination(); + if (extDest != null && extDest.length() > 0) { + linkTraitFound = true; + if (annotsAllowed) { + action = factory.getExternalAction(extDest, extLink.newWindow()); + } } } } @@ -1610,7 +1615,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer { * Adds a PDF XObject (a bitmap or form) to the PDF that will later be referenced. * @param uri URL of the bitmap * @param pos Position of the bitmap - * @deprecated Use {@link @putImage(String, Rectangle2D, Map)} instead. + * @deprecated Use {@link #putImage(String, Rectangle2D, Map)} instead. */ protected void putImage(String uri, Rectangle2D pos) { putImage(uri, pos, null); -- cgit v1.2.3