--- PDFGoTo.java (revision 762754) +++ PDFGoTo.java (working copy) @@ -35,6 +35,7 @@ private String destination = null; private float xPosition = 0; private float yPosition = 0; + private boolean namedDestination = false; /** * create a /GoTo object. @@ -109,6 +110,15 @@ } /** + * Sets a named destination internal to the PDF. + * @param dest the internal named destination. + */ + public void setNamedDestination(String dest) { + this.namedDestination = true; + this.destination = dest; + } + + /** * Get the PDF reference for the GoTo action. * * @return the PDF reference for the action @@ -125,6 +135,8 @@ if (destination == null) { dest = "/D [" + this.pageReference + " /XYZ " + xPosition + " " + yPosition + " null]\n"; + } else if (namedDestination == true) { + dest = "/D (" + this.destination + ")\n"; } else { dest = "/D [" + this.pageReference + " " + destination + "]\n"; } --- PDFFactory.java (revision 762754) +++ PDFFactory.java (working copy) @@ -1028,6 +1028,12 @@ String filename = target.substring(0, index + 4); String dest = target.substring(index + 10); return getGoToPDFAction(filename, dest, -1, newWindow); + } else if (targetLo.startsWith("#")) { + String dest = target.substring(1); + PDFGoTo gt = new PDFGoTo("-1"); + gt.setNamedDestination(dest); + getDocument().registerObject(gt); + return gt; // None of the above? Default to URI: } else { return new PDFUri(target);