chrisg 2003/02/06 16:10:47
Modified: . Tag: fop-0_20_2-maintain CHANGES
examples/fo/basic Tag: fop-0_20_2-maintain link.fo
src/codegen Tag: fop-0_20_2-maintain extproperties.xml
foproperties.xml
src/org/apache/fop/datatypes Tag: fop-0_20_2-maintain
IDNode.java IDReferences.java
src/org/apache/fop/extensions Tag: fop-0_20_2-maintain
ExtensionElementMapping.java
src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain
BasicLink.java
src/org/apache/fop/pdf Tag: fop-0_20_2-maintain
PDFDocument.java PDFGoTo.java PDFGoToRemote.java
PDFRoot.java
src/org/apache/fop/render/pdf Tag: fop-0_20_2-maintain
PDFRenderer.java
Added: src/org/apache/fop/extensions Tag: fop-0_20_2-maintain
Destination.java
src/org/apache/fop/pdf Tag: fop-0_20_2-maintain
PDFDestination.java
Log:
Added support for url()-syntax to the fo:basic-link-Element
Submitted by: Stefan Wachter <[EMAIL PROTECTED]>
Added new extension element for defining named destinations (PDF)
Submitted by: Lloyd McKenzie <[EMAIL PROTECTED]> and Stefan Wachter
Added support for linking to a specific page and a named destinations
of an external PDF file
Submitted by: Bernd Brandstetter <[EMAIL PROTECTED]>
Revision Changes Path
No revision
No revision
1.10.2.47 +7 -0 xml-fop/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/xml-fop/CHANGES,v
retrieving revision 1.10.2.46
retrieving revision 1.10.2.47
diff -u -r1.10.2.46 -r1.10.2.47
--- CHANGES 4 Feb 2003 21:24:18 -0000 1.10.2.46
+++ CHANGES 7 Feb 2003 00:10:44 -0000 1.10.2.47
@@ -1,5 +1,12 @@
==============================================================================
Done since 0.20.4 release
+- Added support for url()-syntax to the fo:basic-link-Element
+ Submitted by: Stefan Wachter <[EMAIL PROTECTED]>
+- Added new extension element for defining named destinations (PDF)
+ Submitted by: Lloyd McKenzie <[EMAIL PROTECTED]> and Stefan Wachter
+- Added support for linking to a specific page and a named destinations
+ of an external PDF file
+ Submitted by: Bernd Brandstetter <[EMAIL PROTECTED]>
- Added Turkish messages for AWT Viewer
Submitted by: Togan Muftuoglu <[EMAIL PROTECTED]>
- Fixed leader expansion and leader alignment to reference area to some
No revision
No revision
1.1.2.2 +10 -0 xml-fop/examples/fo/basic/link.fo
Index: link.fo
===================================================================
RCS file: /home/cvs/xml-fop/examples/fo/basic/link.fo,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- link.fo 13 Jan 2003 18:23:52 -0000 1.1.2.1
+++ link.fo 7 Feb 2003 00:10:45 -0000 1.1.2.2
@@ -128,6 +128,16 @@
go to <fo:basic-link
external-destination="normal.pdf">normal.pdf</fo:basic-link>
</fo:block>
-->
+ <!-- Normal text -->
+ <fo:block text-align="start"
+ space-before.optimum="6pt"
+ line-height="24pt"
+ font-family="serif"
+ padding-top="3pt"
+ >
+ 9. Linking to a specific page of an external:
+ <fo:basic-link external-destination="extensive.pdf#page=1">extensive.pdf,
Page 2</fo:basic-link>.
+ </fo:block>
</fo:flow>
No revision
No revision
1.1.4.1 +6 -1 xml-fop/src/codegen/Attic/extproperties.xml
Index: extproperties.xml
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/Attic/extproperties.xml,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -r1.1 -r1.1.4.1
--- extproperties.xml 6 Feb 2001 07:34:46 -0000 1.1
+++ extproperties.xml 7 Feb 2003 00:10:45 -0000 1.1.4.1
@@ -13,6 +13,11 @@
<datatype>String</datatype>
<default></default>
</property>
-
+ <property>
+ <name>destination-name</name>
+ <inherited>false</inherited>
+ <datatype>String</datatype>
+ <default></default>
+ </property>
</generic-property-list>
</property-list>
1.25.2.7 +7 -0 xml-fop/src/codegen/foproperties.xml
Index: foproperties.xml
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/foproperties.xml,v
retrieving revision 1.25.2.6
retrieving revision 1.25.2.7
diff -u -r1.25.2.6 -r1.25.2.7
--- foproperties.xml 24 Nov 2002 07:23:51 -0000 1.25.2.6
+++ foproperties.xml 7 Feb 2003 00:10:45 -0000 1.25.2.7
@@ -1644,6 +1644,13 @@
<default></default>
</property>
<property>
+ <!-- Property of destination extension element -->
+ <name>destination-name</name>
+ <inherited>false</inherited>
+ <datatype>String</datatype>
+ <default></default>
+ </property>
+ <property>
<name>show-destination</name>
<inherited>false</inherited>
<datatype>ToBeImplemented</datatype>
No revision
No revision
1.4.2.4 +21 -1 xml-fop/src/org/apache/fop/datatypes/Attic/IDNode.java
Index: IDNode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/IDNode.java,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -u -r1.4.2.3 -r1.4.2.4
--- IDNode.java 5 Nov 2002 07:53:47 -0000 1.4.2.3
+++ IDNode.java 7 Feb 2003 00:10:45 -0000 1.4.2.4
@@ -49,6 +49,26 @@
return pageNumber;
}
+ /**
+ * Returns the page reference.
+ *
+ * @return page reference of this node.
+ */
+ public String getPageReference() {
+ if (null != internalLinkGoTo) {
+ return internalLinkGoTo.getPageReference();
+ } else {
+ return internalLinkGoToPageReference;
+ }
+ }
+
+ public int getXPosition() {
+ return xPosition;
+ }
+
+ public int getYPosition() {
+ return yPosition;
+ }
/**
* creates a new GoTo object for an internal link
1.14.2.4 +21 -1 xml-fop/src/org/apache/fop/datatypes/Attic/IDReferences.java
Index: IDReferences.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/datatypes/Attic/IDReferences.java,v
retrieving revision 1.14.2.3
retrieving revision 1.14.2.4
diff -u -r1.14.2.3 -r1.14.2.4
--- IDReferences.java 5 Nov 2002 07:53:47 -0000 1.14.2.3
+++ IDReferences.java 7 Feb 2003 00:10:45 -0000 1.14.2.4
@@ -344,4 +344,24 @@
public Iterator getInvalidElements() {
return idValidation.keySet().iterator();
}
+
+ /**
+ * Returns a destination reference for the node with the
+ * specified id. If id does not exist, returns null.
+ * Destination format is: [ ?objectId 0 R /XYZ ?x ?y null ]
+ *
+ * @param id The id whose destination reference to return
+ * @return Destination reference for this node
+ */
+ public String getDestinationRef(String id) {
+ if (doesIDExist(id)) {
+ IDNode node = (IDNode)idReferences.get(id);
+ return "[ " + node.getPageReference() + " /XYZ " +
+ node.getXPosition()/1000f + " " + node.getYPosition()/1000f + " null ]";
+ } else {
+ addToIdValidationList(id);
+ return null;
+ }
+ }
+
}
No revision
No revision
1.4.2.5 +2 -1
xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java
Index: ExtensionElementMapping.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/extensions/ExtensionElementMapping.java,v
retrieving revision 1.4.2.4
retrieving revision 1.4.2.5
diff -u -r1.4.2.4 -r1.4.2.5
--- ExtensionElementMapping.java 24 Nov 2002 21:29:11 -0000 1.4.2.4
+++ ExtensionElementMapping.java 7 Feb 2003 00:10:45 -0000 1.4.2.5
@@ -26,6 +26,7 @@
foObjs.put("outline", Outline.maker());
foObjs.put("label", Label.maker());
foObjs.put("continued-label", ContinuedLabel.maker());
+ foObjs.put("destination", Destination.maker());
}
}
No revision
No revision
1.1.2.1 +61 -0 xml-fop/src/org/apache/fop/extensions/Attic/Destination.java
No revision
No revision
1.8.2.6 +9 -1 xml-fop/src/org/apache/fop/fo/flow/BasicLink.java
Index: BasicLink.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/BasicLink.java,v
retrieving revision 1.8.2.5
retrieving revision 1.8.2.6
diff -u -r1.8.2.5 -r1.8.2.6
--- BasicLink.java 22 Nov 2002 15:10:46 -0000 1.8.2.5
+++ BasicLink.java 7 Feb 2003 00:10:45 -0000 1.8.2.6
@@ -84,6 +84,14 @@
} else if (!(destination =
this.properties.get("external-destination").getString()).equals("")) {
linkType = LinkSet.EXTERNAL;
+ if (destination.startsWith("url(") && destination.endsWith(")")) {
+ destination = destination.substring(4, destination.length() -
1).trim();
+ if (destination.startsWith("\"") && destination.endsWith("\"")) {
+ destination = destination.substring(1, destination.length() -
1);
+ } else if (destination.startsWith("'") &&
destination.endsWith("'")) {
+ destination = destination.substring(1, destination.length() -
1);
+ }
+ }
} else {
throw new FOPException("internal-destination or external-destination
must be specified in basic-link");
}
No revision
No revision
1.30.2.6 +31 -1 xml-fop/src/org/apache/fop/pdf/PDFDocument.java
Index: PDFDocument.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
retrieving revision 1.30.2.5
retrieving revision 1.30.2.6
diff -u -r1.30.2.5 -r1.30.2.6
--- PDFDocument.java 8 Nov 2002 10:25:26 -0000 1.30.2.5
+++ PDFDocument.java 7 Feb 2003 00:10:46 -0000 1.30.2.6
@@ -1000,6 +1000,7 @@
PDFLink linkObject;
PDFAction action;
+ int index;
PDFLink link = new PDFLink(++this.objectcount, rect);
this.objects.add(link);
@@ -1013,6 +1014,22 @@
action = new PDFGoToRemote(++this.objectcount, fileSpec);
this.objects.add(action);
link.setAction(action);
+ } else if ((index = destination.indexOf(".pdf#page=")) > 0) {
+ String file = destination.substring(0, index + 4);
+ int page = Integer.parseInt(destination.substring(index + 10));
+ PDFFileSpec fileSpec = new PDFFileSpec(++this.objectcount, file);
+ this.objects.add(fileSpec);
+ action = new PDFGoToRemote(++this.objectcount, fileSpec, page);
+ this.objects.add(action);
+ link.setAction(action);
+ } else if ((index = destination.indexOf(".pdf#dest=")) > 0) {
+ String file = destination.substring(0, index + 4);
+ String dest = destination.substring(index + 10);
+ PDFFileSpec fileSpec = new PDFFileSpec(++this.objectcount, file);
+ this.objects.add(fileSpec);
+ action = new PDFGoToRemote(++this.objectcount, fileSpec, dest);
+ this.objects.add(action);
+ link.setAction(action);
} else { // URI
PDFUri uri = new PDFUri(destination);
link.setAction(uri);
@@ -1322,4 +1339,17 @@
this.idReferences = idReferences;
}
+ /**
+ * Make a destination object and add it
+ * @param label the title for the new destination object
+ * @param dest the destination name to reference
+ */
+ public void addDestination(String destinationName, String internalDest) {
+ if (!idReferences.doesIDExist(internalDest)) {
+ idReferences.addToUnvalidatedIdList(internalDest);
+ }
+ PDFDestination obj = new PDFDestination(idReferences, destinationName,
internalDest);
+ root.getDestinations().add(obj);
+ }
+
}
1.6.2.2 +4 -2 xml-fop/src/org/apache/fop/pdf/PDFGoTo.java
Index: PDFGoTo.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoTo.java,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -r1.6.2.1 -r1.6.2.2
--- PDFGoTo.java 31 May 2002 00:17:16 -0000 1.6.2.1
+++ PDFGoTo.java 7 Feb 2003 00:10:46 -0000 1.6.2.2
@@ -48,7 +48,9 @@
this.pageReference = pageReference;
}
-
+ public String getPageReference() {
+ return pageReference;
+ }
/**
* Sets the Y position to jump to
1.3.2.2 +44 -4 xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java
Index: PDFGoToRemote.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- PDFGoToRemote.java 31 May 2002 00:17:16 -0000 1.3.2.1
+++ PDFGoToRemote.java 7 Feb 2003 00:10:46 -0000 1.3.2.2
@@ -19,6 +19,8 @@
* the file specification
*/
protected PDFFileSpec pdfFileSpec;
+ protected int pageReference = 0;
+ protected String destination = null;
/**
* create an GoToR object.
@@ -35,6 +37,38 @@
}
/**
+ * create an GoToR object.
+ *
+ * @param number the object's number
+ * @param fileSpec the fileSpec associated with the action
+ * @param page a page reference within the remote document
+ */
+ public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, int page) {
+
+ /* generic creation of object */
+ super(number);
+
+ this.pdfFileSpec = pdfFileSpec;
+ this.pageReference = page;
+ }
+
+ /**
+ * create an GoToR object.
+ *
+ * @param number the object's number
+ * @param fileSpec the fileSpec associated with the action
+ * @param dest a named destination within the remote document
+ */
+ public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, String dest) {
+
+ /* generic creation of object */
+ super(number);
+
+ this.pdfFileSpec = pdfFileSpec;
+ this.destination = dest;
+ }
+
+ /**
* return the action string which will reference this object
*
* @return the action String
@@ -51,9 +85,15 @@
public byte[] toPDF() {
String p = new String(this.number + " " + this.generation + " obj\n"
+ "<<\n/S /GoToR\n" + "/F "
- + pdfFileSpec.referencePDF() + "\n"
- + "/D [ 0 /XYZ null null null ]"
- + " \n>>\nendobj\n");
+ + pdfFileSpec.referencePDF() + "\n");
+
+ if (destination != null) {
+ p += "/D (" + this.destination + ")";
+ } else {
+ p += "/D [ " + this.pageReference + " /XYZ null null null ]";
+ }
+
+ p += " \n>>\nendobj\n";
try {
return p.getBytes(PDFDocument.ENCODING);
1.10.2.2 +22 -1 xml-fop/src/org/apache/fop/pdf/PDFRoot.java
Index: PDFRoot.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFRoot.java,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -r1.10.2.1 -r1.10.2.2
--- PDFRoot.java 31 May 2002 00:17:16 -0000 1.10.2.1
+++ PDFRoot.java 7 Feb 2003 00:10:46 -0000 1.10.2.2
@@ -11,6 +11,7 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
+import java.util.*;
/**
* class representing a Root (/Catalog) object
@@ -28,6 +29,11 @@
private PDFOutline _outline;
/**
+ * Collection of destinations
+ */
+ private Collection _destinations;
+
+ /**
* create a Root (/Catalog) object. NOTE: The PDFRoot
* object must be created before the PDF document is
* generated, but it is not assigned an object ID until
@@ -76,6 +82,13 @@
return _outline;
}
+ public Collection getDestinations() {
+ if (_destinations == null) {
+ _destinations = new ArrayList();
+ }
+ return _destinations;
+ }
+
/**
* represent the object as PDF.
@@ -95,6 +108,14 @@
p.append(" /Outlines " + _outline.referencePDF() + "\n");
p.append(" /PageMode /UseOutlines\n");
+ }
+ if (_destinations != null) {
+ p.append(" /Names << /Dests << /Names [ ");
+ for (Iterator i = _destinations.iterator(); i.hasNext(); ) {
+ PDFDestination dest = (PDFDestination)i.next();
+ p.append(dest.toPDF());
+ }
+ p.append(" ] >> >>\n");
}
p.append(" >>\nendobj\n");
No revision
No revision
1.1.2.1 +54 -0 xml-fop/src/org/apache/fop/pdf/Attic/PDFDestination.java
No revision
No revision
1.91.2.11 +4 -1 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.91.2.10
retrieving revision 1.91.2.11
diff -u -r1.91.2.10 -r1.91.2.11
--- PDFRenderer.java 9 Jan 2003 01:25:41 -0000 1.91.2.10
+++ PDFRenderer.java 7 Feb 2003 00:10:46 -0000 1.91.2.11
@@ -915,6 +915,9 @@
ExtensionObj ext = (ExtensionObj) extensions.get(i);
if (ext instanceof Outline) {
renderOutline((Outline) ext);
+ } else if (ext instanceof Destination) {
+ Destination d = (Destination)ext;
+ pdfDoc.addDestination(d.getDestinationName(),
d.getInternalDestination());
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]